I've read all the posts regarding this topic and I've not found a solution or at least a solution that was easy for me to implement.
I have a form that once submitted will redirect to a private page with links on that page to download a free item.
I want the user to fill in the form, be redirected to the second page and automatically logged in with a specific username and password, so they can see the private page.
I've tried the following code in my theme functions.php file.
add_action( 'gform_user_registered', 'pi_gravity_registration_autologin', 10, 4 );
/**
* Auto login after registration.
*/
function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
$user = get_userdata( $user_id );
$user_login = $user->user_login;
$user_password = $password;
wp_signon( array(
'user_login' => 'freeitem',
'user_password' => 'samplepassword',
'remember' => false
) );
}
But, I don't really understand how I customize the above code to get it right and even more specific, just for the one form, not all forms.
Any ideas would be greatly appreciated! Love Gravity Forms!!
Louise