WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been searching around for a solution but am coming up dry. I need to have a confirmation email sent to users when their role is upgraded. By default users are signed up as contributors and make them apply to be upgraded to an author and I want an automated email sent to the user as soon as they are upgraded. Any ideas?

share|improve this question
OK, found the answer on another post : [link]wordpress.stackexchange.com/questions/50924/… – user35718 Jul 24 '13 at 11:25
up vote 1 down vote accepted

Send email notification when user role changes - Adding this snippet to the functions.php of your WordPress theme will send the member an email notification when the user’s role has changed.

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);
share|improve this answer
Have you tested this? I put this in my functions.php and tried it and no email was received for account upgraded from contributor to author. – Pollux Khafra May 2 '12 at 16:35
I copied and pasted the code from the link above. The author on the linked page, for some reason, uses "fancy" quotation marks (I don't know the proper term) instead of normal. The "fancy" quotation marks do not work in code. I updated them in the snippet above. It should work now. – Travis Pflanz May 2 '12 at 16:39
Nice catch..works great thanks! – Pollux Khafra May 2 '12 at 16:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.