Send Welcome email to Users when they activate their account on WordPress & BuddyPress Based Social Network

Are you using BuddyPress with standard WordPress (not multisite)? In case of BuddyPress with WordPress, there is no welcome email sent to the user when they activate their account. Though, On a WordPress multisite install, the welcome email is sent on account activation.  Here is a small code snippet that will allow you to send welcome emails to the new users on normal WordPress and BuddyPress installation.

Please put the following code in your bp-custom.php

//send a welcome email when a user account is activated
function bpdev_welcome_user_notification($user_id,$key=false,$user=false) {
        return ;// we don't need it for multisite
	//send the welcome mail to user
    //welcome message
	$welcome_email = __( 'Dear USER_DISPLAY_NAME,

Your new account is set up.

You can log in with the following information:
Username: USERNAME


--The Team @ SITE_NAME' );
    //get user details
	$user = get_userdata( $user_id );
    //get site name
    $site_name = get_bloginfo('name');
    //update the details in the welcome email
	$welcome_email = str_replace( 'USER_DISPLAY_NAME', $user->first_name, $welcome_email );
	$welcome_email = str_replace( 'SITE_NAME', $site_name, $welcome_email );
	$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
	$welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );

    //from email
	$admin_email = get_site_option( 'admin_email' );

	if ( empty($admin_email) )
		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];

	$from_name = $site_name;//from
	$message_headers = "From: \"{$from_name}\" \n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";

	$subject = sprintf(__('Welcome to   %1$s '), $site_name) ;
    wp_mail($user->user_email, $subject, $welcome_email, $message_headers);

    return true;

Here is a screenshot to show what it sends. You may modify the actual content if you want.

Are you going to use this code? Do you think sending a welcome email for newly registered user is a good idea? Please do share your thoughts in the comments below.

PS: This week is going to be awesome. To find out why, please do visit again :)

8 Responses to Send Welcome email to Users when they activate their account on WordPress & BuddyPress Based Social Network

  • Hey, Brajesh.
    I was wondering if it is possible to let user’s create their own page(FAN Page) like that of some big social networking website’s, is there any plugin ??
    It will engage more user’s to a particular BuddyPress Powered website’s.
    I know you can develop like that i requested 😀
    Waiting for your reply Brajesh
    Thank’s .

    • I am sorry but We already have the the plugin to release this month. Hopefully, we will be able to do it next month.


  • This worked great. Thanks!

    One thing that you might be able to help me – I use the excellent free plugin called WP Better Emails – http://wordpress.org/plugins/wp-better-emails/ and it seem that it can find all the wp_mail uses and convert them to the template however not it this case. Any idea how I can edit/change the code to make this work?

  • @Erez Weinstein, you might be doing something wrong i used same WP Better Emails and it works with this tutorial without editing any code.

    Am using a child theme.


  • Thanks a lote dear…
    u made my day … its working fine and absolute. (y)

  • Hi Brajesh, I’m using your auto activate and login plugin and I think it stops this email from being sent out. Since I’m disabling the activation email I would like to still send out a welcome email after a successful registration. Can you please help? Thank you.

    • Hi Joy,
      All you need to do is change the priority of the action like this

      That should do it.

Leave a Reply

Are you looking for support?

Please ask support questions in BuddyDev Forum and help us server you better. Please use comment for general discussion/feature suggestions.

Your email address will not be published. All the fields marked as * are required.

If you are posting code, please use <pre> { Your Code Block } </pre>. Example:- <pre> echo $name; </pre>

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">