1

I am using Gravity Forms and Advanced Custom Fields to add user meta on user Registration.

I have a repeater field which I have managed to populate from form. I am using the values of the meta data as session keys.

But the values will not save until I open up the user account from the back end and save.

I want the user to be able to be logged in after registering and am using this:

add_action("gform_user_registered", "autologin", 10, 4);

function autologin($user_id, $config, $entry, $password) {

        wp_set_auth_cookie($user_id, false, '');

}

Here is the garvity forms hook I'm using to add to repeater fields:

add_action( 'gform_user_registered', 'add_custom_user_meta', 10, 4 );
function add_custom_user_meta( $user_id, $feed, $entry, $user_pass ) {    



$row = array(
            'garden_name'   => 'garden',
            'garden_key'    => 'GARKEY',
            'team'  => 'team1'
        );


            $row2 = array(
            'garden_name'   => 'garden sub1',
            'garden_key'    => 'GARKEY1',
            'team'  => 'team1'
        );
        update_row( 'gardens', $row, $user_id );
        update_row( 'sub_garden_1', $row2, $user_id );


 update_user_meta( $user_id, 'gardens',$row );
 update_user_meta( $user_id, 'sub_garden_1',$row );


 }

Although the meta data is showing in the backend profile of new register it doesn't seem to work until I re-save the user profile.

Any help would be much appreciated

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.