• Resolved pablos22

    (@pablos22)


    I have a problem after enabling the plugin – by default, I use function in my theme

    add_action('user_register','my_function');
    function my_function($user_id){
    
    $userinfo = get_userdata($user_id);
    
    if ( isset( $_POST['first_name'] ) ) {
        $first_name = $_POST['first_name'];
    }
    
    //and other stuff

    but after enabling plugin – i get empty $first_name

    How to solve the problem?

    Please help

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @pablos22,

    Sorry but I am a bit unclear about your query. If you could let me know in a bit more detail, it would be easy for me to assist you. Let me know your requirements in a bit more fact, and I will get back to you.

    Regards!

    Thread Starter pablos22

    (@pablos22)

    My function works with standard user registration.
    When i enable User Registration plugin and change user registration form with your plugin – $_POST[‘first_name’] – is empty.

    How to get from registration form – user first_name when using your plugin ?

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @pablos22,

    You can use the following code snippet to get the first name.

    add_action('user_registration_after_register_user_action','ur_function',10,3); 
    
    function ur_function( $form_data, $form_id, $user_id ){ 
    
        $firstname = ''; 
    
        if( isset( $form_data['first_name']->value ) && ! empty($form_data['first_name']->value) ){ 
    
            $firstname = $form_data['first_name']->value; 
    
        } 
    
    }

    I hope this helps 🙂

    Regards!

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @pablos22,

    Since we did not get a response from your end, we are marking this thread as resolved as we believe the things mentioned here are now resolved. Please create a new support thread if needed.

    Thanks!

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

The topic ‘problem when using plugin with user_register and first_name field’ is closed to new replies.