• Hello,
    I am using your ultimate member plugin. I integrated your plugin with referral code. I want to add field in registeration form like referral code. Referral code plugin admin says this ( Hello, change YOUR_FIELD_ID to your field id. if you don’t know what a field id is, you need to seek help from Ultimate member guys. I’m not a UM user.
    the snippet needs PHP 7>)

    And give me this code (

    add_filter(‘wp_referral_code_new_user_ref_code’ , function ($rec_code, $user_id){
    if (!empty( $rec_code)){
    return $rec_code;
    }

    return sanitize_text_field( $_POST[‘YOUR_FIELD_ID’]) ?? null;
    });`

    ) please let me know how can i implement this?

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

    (@champsupertramp)

    Hi @manpreetsuniara

    The field key is the meta key of your UM Form fields. Please go to WP Admin > Ultimate Member > Forms > Edit a Register form > Click on the Field to edit it. See “Meta key”. Please see the screenshot in the link:
    https://drive.google.com/file/d/1TB276qkYR6dSbIuJexrbA7QeWPJvE31H/view?usp=sharing

    Here’s the sample code with meta key plan

    add_filter(‘wp_referral_code_new_user_ref_code’ , function ($rec_code, $user_id){
    
    if ( ! empty( $rec_code) ){
         return $rec_code;
    }
    
    return sanitize_text_field( $_POST[‘plan’]) ?? null;
    });

    Regards,

    Thread Starter manpreetsuniara

    (@manpreetsuniara)

    hello, thankyou
    but its not working i want to add user by referral code. i put a field in registration form name like a referral code but this snippet is not working. please help me i need this urgent.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @manpreetsuniara

    I just followed what the third-party plugin developer suggested. We haven’t done any integration with that plugin so I suggest that you contact them regarding the issue with their suggested code. Let us know their response.

    Regards,

    Thread Starter manpreetsuniara

    (@manpreetsuniara)

    Thank you for your response,

    Check this ( https://www.ads-software.com/support/topic/how-can-user-register-by-referral-code/ ). Plugin author said to me.they said ask from ultimate plugin members

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @manpreetsuniara

    Please tell the third-party plugin developer that you have the correct field ID in the code below but it doesn’t work with the code that they have provided:

    add_filter(‘wp_referral_code_new_user_ref_code’ , function ($rec_code, $user_id){
    
    if ( ! empty( $rec_code) ){
         return $rec_code;
    }
    
    return sanitize_text_field( $_POST[‘plan’]) ?? null;
    });

    Regards,

    Thread Starter manpreetsuniara

    (@manpreetsuniara)

    Thank you,
    I will ask from plugin developer.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change a field id?’ is closed to new replies.