One of the useful features of the multisite network is the way it allows you to modify each user's experience when creating a new website. You can modify their welcome email and change the default content.

You can do this by accessing the configuration of your network settings in " Settings> Network settings"

But there are two emails that are sent and this is the second of them. Before the website is activated, WordPress sends an activation email with a link, the user must click on it in order to make their website active. Unfortunately, the settings screen does not give you the option to change this setting.

Is there a workaround? The good news is yes, you can write a plugin that modifies this email. And in this tutorial I will show you exactly how to get there.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

Getting started with website activation email personalization

Before you begin, you will need a few things:

  • A WordPress development installation with the multisite option enabled, this will allow you to avoid errors and test everything beforehand.
  • A code editor with FTP access, or a code editor and an FTP client.

Read our tutorial on activating the multisite network to learn more about activating the multisite network.

In this tutorial, we'll explore the source code for WordPress, but you're not going to modify it. Instead, we'll write a plugin that you save in your website's plugins folder and activate for your network.

here are the 25 errors of novice bloggers to avoid at all costs

Default messaging code

Here is the default activation email that is sent when someone registers a website on your network:

Mail-Default-recording--on-a-Site

The subject of the email is " Enable [link] Where [link] is the link to the new website. It's a bit off-putting, in my humble opinion!

The code that generates this is in the file " ms-functions.php " in the file " wp-includes Of your WordPress installation. There are two filters that can be used, one for the message content and one for the subject.

Read also:  How to manage email notifications on WordPress

The first is called " wpmu_signup_blog_notification_email and it allows you to filter the default content of the email itself. In the current version (3.6.1), it is at line 820 in the " ms-functions.php "

apply_filters ('wpmu_signup_blog_notification_email', __ ("To activate your blog, please click on this link: nn% snn After activating, you will receive an email * another email * with your username.nn After activating your site, you will receive a link: nn% s "), $ domain, $ path, $ title, $ user, $ user_email, $ key, $ meta),

This uses placeholders for internationalization and it also uses variables that are defined immediately above the filter. We will use the variable " $ content To define the new version of the content. Each instance of n Is a line break and "n% s »Inserts the path to the blog. We will use them again.

apply_filters ('wpmu_signup_blog_notification_subject', __ ('[% 1 $ s] Enabled% 2 $ s'), $ domain, $ path, $ title, $ user, $ user_email, $ key, $ meta),

The second filter is " wpmu_signup_blog_notification_subject Which defines the subject line of the email. Here is the code (at line 844):

I invite you now to create a plugin, as I showed you in one of our tutorials.

Changing the subject of the email

First, we'll create a function that defines the subject of our new version of the email.

Start by creating an empty function and link it to the corresponding filter:

Function wpmu_activation_email_subject () {} add_filter ('wpmu_signup_blog_notification_subject', 'wpmu_activation_email_subject');

Now we are going to populate this function. Inside the braces, add this code:

$ subject = __ ('Hello, please activate your site with this link% 1 $ s'); return $ subject;

This has new text, but it also uses the placeholder to display the value of the network title, which is available in the original file by the variable " $ from_name ».

Save your file and we will proceed to modify the content of the email.

To discover also: How to Reset a WordPress Blog

Changing e-mail content

The second function will modify the content of the email.

In the plugin file, add a second empty function related to the correct filter:

Function wpmu_activation_email_content ($ content) {} add_filter ('wpmu_signup_blog_notification_email', 'wpmu_activation_email_content');

Now perform this function of the following:

Again it's done using a placeholder: this time it's " n% s ", Which displays the link to the new website and is provided by the variable $ activate_url in the original function in the base file.

Here is the full content of your plugin:

$ content = __ ("Thank you for creating a website. Before you can use the site, you must activate it. nnTo activate your site, please click on this link: nn% snnAfter activation, you will receive an email with your login. Once you have done that, you can manage your with this liennnEnjoy your site! "); return $ content;

All you have to do now is install and activate the plugin. You may be able to run tests to make sure everything is working normally.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. Interactive World Maps

Interactive World Maps is a WordPress Plugin premium that helps you create as many maps as you want, with interactive and colorful markers, continents, countries or regions.

Interactive world maps wordpress plugin

It is fully compatible with the new version of WordPress as well as Visual Composer.

Enrich your reading by discovering How to display your stores in a Google Map on WordPress

Thanks to this plugin, you can display several types of regions such as: a map of the whole world, a continent or a subcontinent (Africa, Europe, Americas, Asia, Oceania and all their subcontinents), a country, a country divided by its regions, a state of the United States, the United States divided by metropolitan regions, a state of the United States divided by metropolitan regions.

Download | Demo | Web hosting

2. Title Experiments

Good content will attract readers with its title. The titles of your posts are extremely important as they can attract or turn off potential new readers. Therefore, it is really important that your post titles can grab the attention of readers.

Title experiments

Title Experiments is a WordPress Plugin which allows you to post test titles. You can use multiple titles for a single post and check which ones work best.

Download | Demo | Web hosting

3. Pro Custom Admin

Le WordPress Plugin premium Pro Custom Admin, allows you to easily customize your website's registration and login pages or create a maintenance page.

Pro custom admin

It offers a number of features, the main ones we will mention: change the background color and the login page logo, add custom favicon backend and frontend of your website, change the colors of links and buttons, customize the footer text that appears on each admin page, remove the WordPress version number from the footer, updates free and for life, and many more.

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here ! That's it for this tutorial, I hope it will allow you to configure the activation email of a website in a WordPress multisite network. 

However, you can also consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on WordPress blog creation.

If you have suggestions or remarks, leave them in our section Comments. Do not hesitate to share with your friends on your favorite social networks

...