关于使用personal_options_update
但为了安全起见,添加edit_user_profile_update
而且至于在WordPress中发送电子邮件,最好的方法是使用wp_mail, 比如:
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 = \'[email protected]\';
$subject = \'user updated profile\';
$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);
}
}