• Resolved aymanibrahim77

    (@aymanibrahim77)


    hello
    in UM registration form want to remove username field and use mobile number field as username
    how to do that please
    regards

Viewing 13 replies - 16 through 28 (of 28 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    Could you please share the code of um_field_data shortcode?

    Regards,

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Dear @champsupertramp also another note since I am using mycred to transfer points from user to user
    if I write 01234 its appear in transfer form recipient field 012345689 and that indicator that there is username = 012345689 but when press transfer button to send points to this user
    I got error said that this Recipient not found. so I think this also has relation with the above issue

    thank you

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    Could you please share the code of your shortcode um_field_data? I’ll review it.

    Regards,

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Hi @champsupertramp the code

    // Display field data of Ultimate Member
    // e.g. [um_field_data userid="10' field="company_name"]
    add_shortcode( 'um_field_data', 'um_custom_field_shortcode' );
    
    if ( ! function_exists( 'um_custom_field_shortcode' ) ) {
    	function um_custom_field_shortcode( $atts = array() ){
    
    		$defaults = array(
    				'field' => NULL,
    				'userid' => NULL,
    		);
    
    		$atts = wp_parse_args( $atts, $defaults );
    		extract( $atts );
    
    		ob_start();
    
    		$user_id = um_user($atts['userid']);
    		um_fetch_user( $user_id );
    		$meta_value = um_user($atts['field']);
    
    		print_r($meta_value);
    
    	    $shortcode_content = ob_get_contents();
    	    ob_end_clean();
    
    	    return $shortcode_content;
    	}
    }

    thank you

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    I just tried your code for the custom shortcode. It returns the correct user_login added in the Profile and Account pages. I don’t see any correlation with the MyCred issue here. Do you use the shortcode [um_field_data] for the MyCred shortcode?

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    I’m also confused on this part:

    in frontend in account page and in profile page and when use [um_field_data field=user_login] to show username
    all these things show username as (firstname+secondname “if I didn’t fill email field”) and can show username as (email “if I fill email filed”) and that instead of the right thing “0123456789”

    Can you share a video clip showing the issue?

    Regards,

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Dear @champsupertramp please forget the part of mycred
    will clear issue in simple way
    when using the code of making mobile number field create the username I got the next :
    1-created username = mobile number field in backend user edit page as ex 012345689 (right)
    but do another wrong things
    in frontend end UM account page and in UM profile page
    all these things show username as (firstname+secondname instead of the right thing “0123456789”

    so please advise how to fix this
    best regards`

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    I tried the steps but I didn’t encounter the issue. Please see my test in the video:
    https://drive.google.com/file/d/193dV9ignxWMpfEIw5aylaB9d0fSqKRiS/view?usp=sharing

    Regards,

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Dear @champsupertramp
    I see !!
    I restored old database and I found everything is good
    so its look something happened to the database did this issue

    another note :
    I added username and email field to profile form but in front end profile page or edit profile page it is disappeared

    please recommend what to do?
    and also will record video to let you see
    https://www.mediafire.com/file/8085ib90tp2istn/video1306195161.mp4/file

    any way to reset only ultimate member database data to create it from scratch without restore all my site from scratch ?
    regards

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Dear @champsupertramp
    I found exactly where is the problem
    as I told before

    when using the code of making mobile number field create the username I got the next :
    1-created username = mobile number field in backend user edit page as ex 012345689 (right)
    but do another wrong things
    in frontend end UM account page and in UM profile page
    all these things show username as (firstname+secondname instead of the right thing “0123456789”

    after that if I go to UM dashboard and cleared users cache then every thing become normal and username become 012345689 in um account and um profile pages

    so please advise how to fix that without the need to clear this cache every new user
    best regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    Please try adding this code snippet to clear cache after the registration:

    add_action("um_registration_complete","um_011822_clear_cache_after_registration");
    function um_011822_clear_cache_after_registration( $user_id ){
        UM()->user()->remove_cache( $user_id );
    }
    

    Regards,

    Thread Starter aymanibrahim77

    (@aymanibrahim77)

    Dear @champsupertramp
    thanks a lot it works
    best regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @aymanibrahim77

    Thanks for letting us know.

    Regards,

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘mobile field in stead of username’ is closed to new replies.