Fli
02-03-2014, 02:57 PM
Hi, did You found any easy and good Wordpress plugin which email user when his wordpress user account role is changed? (author, contributor, subscriber..)
so far i used this manual code editting hack:
function user_role_update( $user_id, $new_role ) {
if ($new_role == 'author') {
$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 user account role was changed at '.$site_url.', new role is: "' .$new_role. '".
Thank You';
wp_mail($to, $subject, $message);
}
}
add_action( 'set_user_role', 'user_role_update', 10, 2);
This should be pasted on the second line (after first line which is: <?php) into functions.php file (Wordpress/Appearance/Editor)
if($new_role == 'author')
this can be also contributor, cubscriber etc...
so far i used this manual code editting hack:
function user_role_update( $user_id, $new_role ) {
if ($new_role == 'author') {
$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 user account role was changed at '.$site_url.', new role is: "' .$new_role. '".
Thank You';
wp_mail($to, $subject, $message);
}
}
add_action( 'set_user_role', 'user_role_update', 10, 2);
This should be pasted on the second line (after first line which is: <?php) into functions.php file (Wordpress/Appearance/Editor)
if($new_role == 'author')
this can be also contributor, cubscriber etc...