Embed Snippet on Your Site
MemberPress: Send Email to User When Their User Role Is Changed
Adding this code snippet to a website will send an automated email to the user each time their WordPress user role is changed.
The subject of the email that will be sent with the example code is: “Your role has changed: yourdomain.com”. You can modify this by changing the Your role has changed: text on the following line:
$subject = "Your role has changed: ".$site_url; // Email Subject
Further, the content (body) of the email in this example will look like this: Hello [User’s name], your role has changed on yourdomain.com, congratulations you are now an [New User Role].
You can modify the email body by adjusting text on this line:
$message = "Hello " .$user_info->display_name . ", your role has changed on ".$site_url.", congratulations you are now an " . $new_role; //Email Body
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments