Gerard
Gerard

Reputation: 203

E-mail notification if new WordPress user account is pending

I wan't to have a e-mail notification if a new WordPress (Buddypress) user account is pending. I want to activate the accounts manually so a notification would be nice. Any ideas?

Upvotes: 1

Views: 1194

Answers (3)

Nuno Sarmento
Nuno Sarmento

Reputation: 427

If you like to send the notification to multiple admins|moderators you can use the code below.

/**
 * E-mail notification if new WordPress user account is pending
*/
function my_function( $user_id, $user_login, $user_password, $user_email, $usermeta ){

$to = '[email protected]';

$body = 'New user on pending signups list';

$headers = array(
     'Content-type: text/html',
     'Cc: Email 2 <[email protected]>',
     'Cc: Email 3 <[email protected]>',
);

wp_mail( $to, $user_login . ' has just registered', $body, $headers ); 

}
add_action( 'bp_core_signup_user', 'my_function', 10, 5 );

Upvotes: 0

henrywright
henrywright

Reputation: 10240

You could add this to your theme's functions.php file.

function my_function( $user_id, $user_login, $user_password, $user_email, $usermeta ) {
    // Send the email notification.
    wp_mail( '[email protected]', $user_login . ' has just registered', 'Feel free to log in and activate this new member.' );
}
add_action( 'bp_core_signup_user', 'my_function', 10, 5 );

In this example, if a user registers with a username of joe, then the email notification you will get will look like this:

Email subject line: joe has just registered

Email body: Feel free to log in and activate this new member.

Upvotes: 4

Howli
Howli

Reputation: 12479

The plugin New User Approve, will achieve this. Install it and activate it, then tick the option in the General tab of Settings to "Anyone can register". And when a user tries to register you will get an email asking to confirm the new used.

Upvotes: 0

Related Questions