• Resolved bkrascal

    (@bkrascal)


    For this great plugin, I am asked by my client to create additional functionality when logging in.

    They would like the site to automatically generate the user name using the the first name of the new subscriber, and his company name.

    For example “firstname@mycompanyname

    Creating an input field for the first name, and a dropdown menu for the company name should be no problem. Having them connected with an “@”symbol and together the entire string become the username is the goal.

    Can anyone guide me through this process? Will it be custom coding? a plug in?
    Thank you very much in advance!

    The page I need help with: [log in to see the link]

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

    (@champsupertramp)

    Hi @bkrascal

    This requires customization on your end. You can try the code snippets below. You can add the code 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_042121_change_user_role", 1, 2 );
    function um_042121_change_user_role( $user_id, $args ){
       
        if( isset( $args['first_name'] ) && isset( $args['company_name'] ) ){
          $user_login = $args['first_name'] . "@". $args['company_name'];
          wp_update_user( array( 'ID' => $user_id, 'user_login' => $user_login ) );
        }
    }

    Ensure that the First name field has first_name meta key and Company name field has company_name as a meta key.

    Regards,

    • This reply was modified 4 years, 4 months ago by Champ Camba.
    Thread Starter bkrascal

    (@bkrascal)

    Hi @champsupertramp

    I truly appreciate your support here. Really amazing. I will look into all the advice and the code you offered me. Extremely helpful.

    So far your info is my only lead. May I check back with you later after I look into this for your advice?

    Thank you very again!
    Kindest regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bkrascal

    …Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help… 🙂

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Auto Generated Username UltimateMember’ is closed to new replies.