Embed Snippet on Your Site
MemberPress: Send “Profile Updated” Admin Notification
The code changes WordPress's functioning to send notifications to the admin when a user modifies their profile.
In the example code, the following lines were used to retrieve specific user data and create the arguments to display that data:
$user_name = $user_info->display_name;
$user_email = $user_info->user_email;
These arguments are added to the message to display retrieved user data in the e-mail body:
$message = "Profile of $user_name , $user_email has been updated!";
Following this logic, you can also add other arguments and update the message you wish to receive.
In addition, the code can be modified to send this notification to any other e-mail. To do this, the code needs to be updated on the following line:
wp_mail( '[email protected]', $subject, $message);
Here, users can add any e-mail address they want instead of [email protected]
The code above works only with the default when the WordPress user profile is updated, but it doesn’t work for the MemberPress-specific data changes when user data is edited on our Account page.
Thus, if the notification needs to be triggered also when users modify data through their Account page, an additional code snippet is needed (both snippets are required): https://library.wpcode.com/snippet/05k4dv6o/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments