Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#50062 closed defect (bug) (invalid)

Updating user extra fields.

Reported by: alienoiduk's profile Alienoiduk Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.4
Component: Users Keywords: close
Focuses: Cc:


Hi in creating a plugin i have extra fields in the users profile. I can add these at registration and even as a new user from administration panel but this does not work when updating the user.
I am using the hook 'edit_user_created_user' in the file
wp-admin/includes/user.php lines 227 - 242

if ( $update ) {
		$user_id = wp_update_user( $user );
	} else {
		$user_id = wp_insert_user( $user );
		$notify  = isset( $_POST['send_user_notification'] ) ? 'both' : 'admin';

		 * Fires after a new user has been created.
		 * @since 4.4.0
		 * @param int    $user_id ID of the newly created user.
		 * @param string $notify  Type of notification that should happen. See wp_send_new_user_notifications()
		 *                        for more information on possible values.
		do_action( 'edit_user_created_user', $user_id, $notify );<------ THIS LINE
        <------SHOULD BE HERE

If the do action is moved down one line then it will work for new users and updating users.
I think that is correct.
Thank you

Change History (4)

#1 @sebastienserre
4 years ago

Hello @Alienoiduk and many thanks for your idea.
IO moving down, I think creating a new hook one line dosn would be better to keep working the plugins and theme hooked on this one.

#2 @SergeyBiryukov
4 years ago

  • Keywords close added
  • Severity changed from major to normal

Hi there, welcome to WordPress Trac! Thanks for the report.

As the name implies, the edit_user_created_user action is intended to fire only after a new user has been created.

You can use any of these actions that fire when updating an existing user:

#3 @Mista-Flo
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#4 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.