Merge pull request #921 from ultimatemember/fix/update_display_name

Update Display name in Account update
This commit is contained in:
Nikita Sinelnikov
2021-09-20 21:37:17 +03:00
committed by GitHub
+9 -5
View File
@@ -495,13 +495,17 @@ add_action( 'um_before_account_notifications', 'um_before_account_notifications'
/**
* Update Profile URL
* Update Profile URL, display name, full name.
*
* @param $user_id
* @param $changed
* @version 2.2.5
*
* @param int $user_id The user ID.
* @param array $changes An array of fields values.
*/
function um_after_user_account_updated_permalink( $user_id, $changed ) {
UM()->user()->generate_profile_slug( $user_id );
function um_after_user_account_updated_permalink( $user_id, $changes ) {
if ( isset( $changes['first_name'] ) && isset( $changes['last_name'] ) ) {
do_action( 'um_update_profile_full_name', $user_id, $changes );
}
}
add_action( 'um_after_user_account_updated', 'um_after_user_account_updated_permalink', 10, 2 );