Home / Archive / MemberPress: Send “Profile Updated” Admin Notification When MemberPress Account Is Updated
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Send “Profile Updated” Admin Notification When MemberPress Account Is Updated

Similar to the code snippet here: https://library.wpcode.com/snippet/m5ye1wj2/, this code sends a notification to the admin when a user modifies information on their MemberPress Account page.

Code Preview
php
<?php
function account_user_profile_update( $user ) {
  $user_id = $user->ID;
  $site_url = get_bloginfo( 'wpurl' );
  $user_info = get_userdata( $user_id );
  $user_name = $user_info->display_name; //Retrieves user's full name
  $user_email = $user_info->user_email; //Retrieves user's e-mail address
  $subject = "Profile Updated: ".$site_url."";
  $message = "Profile of $user_name , $user_email has been updated!"; //Displays retrieved user data in the message
  wp_mail( get_bloginfo( 'admin_email' ), $subject, $message );
}
add_action( 'mepr-event-member-account-updated', 'account_user_profile_update' );

Comments

Add a Comment