Hello,
Can I know how can I set up a condition to be redirected to another page if a user already exists? This option of getting the username is not available in the default Gravity forms conditions.
What I tried was to
Store entry to a variable. check for $username with username_exists() function and then redirect using array of confirmation.
add_action('gform_confirmation_2', 'redirect_registered_to_gated', 100, 4 );
function redirect_registered_to_gated( $confirmation, $form, $entry, $ajax)
{
$username = strtolower( rgar($entry, '7'));
if ( $form['id'] == '2' && username_exists( $username )) {
$confirmation = array( 'redirect' => 'https://url' );
}
return $confirmation;
}
Do I need to do anything more?