issue when using mobile field as username
-
Dear
we add the next code to let us can be able to use mobile field instead username in some registration form and it is work and at the same time I need another registration form that is normal (use username)
but when use the normal form
the username of the created user become empty in user edit profile page in backendI need to use tow registration form
form uses mobile field as username after using the next code it works right and the created username is phone number (right)
add_action("um_submit_form_register","um_090321_mobile_number_zero_validation", 1 ); function um_090321_mobile_number_zero_validation( $post_form ){ if( isset( $post_form['mobile_number'] ) && ! empty( $post_form['mobile_number'] ) ){ if ( strpos( $post_form['mobile_number'], '0') !== 0) { UM()->form()->add_error('mobile_number', __( 'Mobile Number must begin with 0', 'ultimate-member' ) ); } if( username_exists( $post_form['mobile_number'] ) ) { UM()->form()->add_error('mobile_number', __( 'Mobile Number already registered', 'ultimate-member' ) ); } } } add_action("um_user_register","um_090321_after_register_complete", -1, 2 ); function um_090321_after_register_complete( $user_id, $args ){ global $wpdb; $wpdb->update( $wpdb->users, array('user_login' => $args['mobile_number'] ), array('ID' => $user_id)); }
but
when using normal form that use username field to create username I got the next issue
the username field of the created user is empty without any username inside itso please how to fix this issue
regards
- The topic ‘issue when using mobile field as username’ is closed to new replies.