WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#50062 new defect (bug)

Updating user extra fields.

Reported by: Alienoiduk Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4
Component: Users Keywords: close
Focuses: Cc:

Description

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
Simon

Change History (2)

#1 @sebastienserre
3 months 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
3 months 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:

Note: See TracTickets for help on using tickets.