Edit Activate and Welcome Registration Emails on WP Multisite

Hello.

I'd like to change the subject and content of the activation and welcome email. Plugins exists to modify the welcome email but NOT the activation email.

In a plugin I'm using, the function wpmu_signup_blog() is used to signup a user. How can I add a filter or hook and where would I put it to change the content?

Thanks,
Giovanni

  • Arun Basil Lal
    • New Recruit

    Hello Giovanni,

    Have a look at one of the core files ms-functions.php in the wp-includes folder of your installation. Find the following function that has the Activation email details:

    wpmu_signup_user_notification()

    You can read more about this method here: http://codex.wordpress.org/Function_Reference/wpmu_signup_user_notification

    You can add a filter (see the link above) and modify the content.

    You look like someone who can take it from here, so am gonna go ahead and mark this as resolved. But in case you get stuck, or you want more details and specifics, just let me know, I would be glad to help you out :slight_smile:

    Looking forward to hear from you on how it went!

    Arun Basil Lal

  • Giovanni
    • The Incredible Code Injector

    Hi Arun,

    Thanks for that and sorry for the delay. I read that and unfortunately I'm still too young in the WP world...

    I'm actually having users create a site when they register so I believe I need this function:

    wpmu_signup_blog_notification

    Since the link you sent states this: "This is the notification function used when no new site has been requested. "

    But as you can see, http://codex.wordpress.org/WPMU_Functions/wpmu_signup_blog_notification is not very well documented.

    What I really need is to send a welcome email, I am now using the "remove-email-verification" plugin from WPMUDEV to bypass verification all together.

    I'd like to incorporate the welcome email directly on my theme instead of using a plugin. I tried my best but no success ...

    Any help would be greatly appreciated!

    Giovanni

  • Arun Basil Lal
    • New Recruit

    Hello Giovanni,

    Before we start, I checked out your site and its awesome! I checked out the route and you have been to India and to Cochin too! I live in Cochin :slight_smile:

    I hope you had a great stay in India, I have added your blog to my feeds. Hope to catch-up on that later..

    You got a point there, the function you specified seems to be the correct one. To speak of which, am a baby when it comes to hard-core WP as well. So I have asked Ve, our developer to help you out here. You know, he is awesome!

    I am looking forward to what he comes up as well, and learn from it :slight_smile:

    Arun Basil Lal

  • Giovanni
    • The Incredible Code Injector

    Thanks Arun.

    Yes, I really enjoyed my time in Cochin and India in general. I spent 40 days and not enough. I loved Kerala and the backwaters. Sad we missed each other!

    I look forward to answer as this is still unresolved!

    See you in the forums!

    Giovanni

  • maxaud
    • The Crimson Coder

    Add this code to your theme's functions.php folder or create a plugin out of it.

    This should change the content and the subject line.

    Notice the placeholders for urls/etc.

    <?php
    
    	function change_activation_content( $content ) {
    
    		$content = __( 'This is new content. Click Here to Activate: %s. The main Site can be viewed here: %s' );
    
    		return $content;
    	}
    	add_filter( "wpmu_signup_blog_notification_email", "change_activation_content" );
    
    	function change_activation_subject( $subject ) {
    
    		$subject = __( '[%1$s] Activate %2$s. This is a new subject.' );
    
    		return $subject;
    	}
    	add_filter( "wpmu_signup_blog_notification_subject", "change_activation_content" );
    
    ?>
  • Arun Basil Lal
    • New Recruit

    Hello Giovanni,

    So glad to hear that, I hope you come back sometime again :slight_smile:

    Regarding the answer, I had kept bookmarked to work on when I get a bit of time, but what @maxaud has given looks perfect.

    I went ahead and tried it out, it works good. Here is a cleaned up version of the same. Thanks @maxaud and @Ve for looking into this :slight_smile:

    Add this to your functions.php of your theme. (Also look into lines 728-732 in wp-includes/ms-functions.php to see the original function if you are interested to learn more.)

    // Start changing email body
    function myprefix_change_activation_email_body ($old_body, $domain, $path, $title, $user, $user_email, $key, $meta) {
    	$my_message = "Hi! This is my new email! ";
    	$my_message .= "Your site {$title} is almost ready. We probably also want to include the activation key: {$key} ";
    	$my_message .= "Activate your site here : http://{$domain}{$path}wp-activate.php?key=$key";
    	// ... other stuff
    	return $my_message;
    }
    add_filter('wpmu_signup_blog_notification_email', 'myprefix_change_activation_email_body', 10, 8);
    // End changing email body
    
    // Start changing email subject
    function myprefix_change_activation_email_subject ($old_subject, $domain, $path, $title, $user, $user_email, $key, $meta) {
    	$my_subject = "Hi! You just registered on my site!";
    	return $my_subject;
    }
    add_filter('wpmu_signup_blog_notification_subject', 'myprefix_change_activation_email_subject', 10, 8);
    // End changing email subject
    // Start changing email subject
    function myprefix_change_activation_email_subject ($old_subject, $domain, $path, $title, $user, $user_email, $key, $meta) {
    	$my_subject = "Hi! You just registered on my site!";
    	return $my_subject;
    }
    add_filter('wpmu_signup_blog_notification_subject', 'myprefix_change_activation_email_subject', 10, 8);
    // End changing email subject

    Let me know if you get stuck somewhere :slight_smile:

    Arun Basil Lal

  • MArio
    • Site Builder, Child of Zeus

    Hello, i put the code in the functions.php but now my site gives me an error message:

    Fatal error: Cannot redeclare myprefix_change_activation_email_subject() (previously declared in /web/htdocs/www.makeupinusa.com/home/wp-content/themes/gt3-wp-shopper/functions.php:179) in /web/htdocs/www.makeupinusa.com/home/wp-content/themes/gt3-wp-shopper/functions.php on line 189

  • Timothy Bowers
    • Chief Pigeon

    Hey there.

    Thanks for posting in this thread, however it might be best if you open your own, even if the issues seem closely related. That way it will remain independent of this one and ensure it doesn't confuse issues here if this thread needs reopening again by the author.

    Posting on old threads can also lead to us missing your questions.

    It also means the member who started this thread or anyone following it isn't inundated with post notifications each time we respond to each other. A lengthy thread could annoy the original thread starter

    This also allows us to better track and answer your questions to ensure we don't miss any for ya.

    If the current thread is relevant then please feel free to link back to this in your new one.

    You can start a new thread here:

    https://premium.wpmudev.org/forums/#question

    FYI, you must be trying to use this function twice myprefix_change_activation_email_subject, it can only declared once.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.