Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Set Nickname to be First+Last name on registration process

  • Resolved stefanoulivieri

    (@stefanoulivieri)


    Hi,
    there’s a way to auto-set the nickname to be First+Last name
    when an user create an account

    by default nickname is like the username

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @stefanoulivieri

    You can try adding the following code snippet to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code:

    add_action( 'um_registration_complete', 'um_100521_change_nickname' ,10, 2 );
    function um_100521_change_nickname( $user_id, $args ){
       
        if( isset( $args['first_name'] ) &&  isset( $args['last_name'] ) ){
    
            $nickname = $args['first_name'] . " " . $args['last_name'];
            update_user_meta( $user_id, "nickname", $nickname );
           
        }   
    }

    The above code will make the First + Last Name a Nickname.

    Regards,

    Thread Starter stefanoulivieri

    (@stefanoulivieri)

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set Nickname to be First+Last name on registration process’ is closed to new replies.