Hi
I am trying to change the redirect location of a form based on data checked within gform_after_submission
. I was wondering where to trigger the gform_confirmation
filter?
Essentially what is happening is this:
/** Set location to redirect to if the email address is changed */
function changed_username_redirect($confirmation, $form, $lead, $ajax){
$confirmation = array("redirect" => site_url('/login/?updated=profile'));
return $confirmation;
}
/** Update user profile after form is submitted */
function my_profile_update( $entry, $form ) {
// I have functions to update the user's profile here
// If user's email address has changed
if ( $user_email != current_user_email() ) {
// Change redirect location as we will be booted out
add_filter('gform_confirmation_4', 'changed_username_redirect', 100, 4);
}
}
add_action( 'gform_after_submission_4', 'my_profile_update', 100, 2 );
But it is not picking up the change in confirmation redirect.
Do I have something wrong in the position / ordering of the filter?
Am I able to change the redirect location, or do I need to trigger the filter earlier?
Thanks