Generate username after registraion
-
I found this topic:
https://www.ads-software.com/support/topic/auto-generated-username-ultimatemember/
But it didn’t work for me. I use the same code, only in my case the meta key is called verein_name. However, the user name is always saved as the standard combination: firstnamelastname
Has the procedure changed here?
This is my code in the functions.php:add_action("um_registration_complete","um_042121_change_user_role", 1, 2 ); function um_042121_change_user_role( $user_id, $args ){ try { if( isset( $args['verein_name'] ) ){ wp_update_user( array( 'ID' => $user_id, 'user_login' => $args['verein_name'] ) ); } else { wp_update_user( array( 'ID' => $user_id, 'user_login' => $args['last_name'].'-'.$args['first_name'] ) ); } } catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } }
Am I missing something?
Thanks in advanceThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Generate username after registraion’ is closed to new replies.