Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- @ Send email to admin if the user updated his profile - Method-1
- **/
- add_action( 'personal_options_update', 'notify_admin_on_update' );
- add_action( 'edit_user_profile_update','notify_admin_on_update' );
- function notify_admin_on_update(){
- global $current_user;
- get_currentuserinfo();
- if (!current_user_can( 'administrator' )){// avoid sending emails when admin is updating user profiles
- $to = get_option( 'admin_email' );
- $subject = 'The User Profile Updated';
- $message = "The user : (" .$current_user->display_name . ") has updated his profile with:\n";
- foreach($_POST as $key => $value){
- $message .= $key . ": ". $value ."\n";
- }
- wp_mail( $to, $subject, $message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement