latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Notification email

Home Forums Community Forum Notification email

Tagged: ,

This topic contains 1 reply, has 2 voices. Last updated by  Raam Dev 4 years, 8 months ago.

Topic Author Topic
Posted: Monday Apr 16th, 2012 at 5:19 am #10877
Richard Vencu
Username: rvencu

Hi, please let me know how can I configure a notification email to be sent to the user when I manually change his role (for instance an upgrade or a downgrade between Bronze and Free levels)

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Monday Apr 16th, 2012 at 6:29 pm #10944
Raam Dev
Username: Raam
Staff Member

Hi Richard,

You can add the following code to your theme’s functions.php file to send an email notification upon role change:

function user_role_update( $user_id, $new_role ) {
        $site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email;
        $subject = "Role changed: ".$site_url."";
        $message = "Hello " .$user_info->display_name . " your role has changed on ".$site_url.", congratulations you are now an " . $new_role;
        wp_mail($to, $subject, $message);
}
add_action( 'set_user_role', 'user_role_update', 10, 2);
Viewing 1 replies (of 1 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.