• Resolved linrador

    (@linrador)


    I’m trying to update the first name and the nickname / displayname of a user after he has logged in via hybridauth. Although I’m able to get all necessary information the user does not update its first name and nickname.

    $userdata = array( 
    	'ID'    	=> $user_id,
    	'user_email'    => $user_email,
    	'display_name' 	=> $display_name,
    	'user_nicename' => $display_name,
    	'first_name'    => $display_name,
    	'user_url'      => $hybridauth_user_profile->profileURL,
    	'description'   => $hybridauth_user_profile->description,
    );
    	
    wp_update_user( $userdata );
    	
    update_user_meta($user_id, 'first_name', $display_name);
    update_user_meta($user_id, 'nickname', $display_name);

    Any help would be very much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    update_user_meta() should do it. Check the return value. It should be true on success. If not, there may have been something wrong with the supplied values. Verify they are indeed what they should be.

    Or the issue could be the context from which you made the call. What is causing your code to execute?

    Thread Starter linrador

    (@linrador)

    Thank you for your reply!
    I’ve checked the return value and it returned true indeed but the value didn’t change.
    I’ve set the update_user_meta() to a later position in my code and it is working now!

    • This reply was modified 2 years, 6 months ago by linrador.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to update user meta’ is closed to new replies.