$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>plugins - How do I get the user ID of the user that was updated in WordPress?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugins - How do I get the user ID of the user that was updated in WordPress?

matteradmin11PV0评论

I want to run a custom function in my plugin that notifies me of the user that's email has been updated in wordpress backend. But i am not sure how do I get the user ID of that user, since this action hook add_action( 'update_user', 'when_update_user' ); requires me to pass an user ID to run when_update_user() function when an administrator updates the user data. Does anyone have any idea regarding it?

I want to run a custom function in my plugin that notifies me of the user that's email has been updated in wordpress backend. But i am not sure how do I get the user ID of that user, since this action hook add_action( 'update_user', 'when_update_user' ); requires me to pass an user ID to run when_update_user() function when an administrator updates the user data. Does anyone have any idea regarding it?

Share Improve this question asked Jan 12, 2019 at 5:39 Biraj GautamBiraj Gautam 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

You're looking for profile_update & user_register.

user_register is called after a user is created.

add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
    // Do stuff with $user_id
}

profile_update is called after a user is updated.

add_action( 'profile_update', 'my_profile_update', 10, 2 );
function my_profile_update( $user_id, $old_user_data ) {
    // Do stuff with $user_id
}
Post a comment

comment list (0)

  1. No comments so far