Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-01T21:43:08-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16143 2011-12-01T21:43:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16143&p=54346#p54346 <![CDATA[Re: Send email when role changed manually]]>
If you want to modify the email sent by s2Member when an existing user is being upgraded/downgraded, take a look at this: viewtopic.php?f=4&t=10368&p=33365&hilit=basic+transactional#p33365

If you want to send an email when you manually change the user role, you'll need to modify the behavior of WordPress by adding a function like the following to your theme's functions.php file:

Code:
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);
 


If you only want to send an email when changing the user role to "Free Subscriber", you'll need to adjust the function code to check $new_role and only proceed with sending the email if it equals "subscriber".

Statistics: Posted by Raam Dev — December 1st, 2011, 9:43 pm


]]>
2011-12-01T09:46:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16143&p=54312#p54312 <![CDATA[Send email when role changed manually]]>
Thanks.

Craig

Free version 111105

Statistics: Posted by cforant — December 1st, 2011, 9:46 am


]]>