I want to redirect based on conditions in Gravity Forms.
//REDIRECT BASED ON GRAVITY SELECTIONS
add_filter( 'gform_confirmation_17', __NAMESPACE__ . '\\redirectfilter', 10, 4 );
function redirectfilter($confirmation, $form, $entry, $ajax) {
GFCommon::log_debug( __METHOD__ . '(): started.' );
session_start();
$laatste = $entry['1'];
if(isset($_SESSION['form'])) {
GFCommon::log_debug( __METHOD__ . '(): SESSION[form] is set.' );
$result = array();
foreach($_SESSION['form'] as $row){
$result[] = $row;
}
if ($result[0] === 'Diesel' && $result[1] === 'Mobiel' && $laatste === 'Kunststof' ) {
GFCommon::log_debug( __METHOD__ . '(): Diesel and Mobiel and Kunststof' );
$confirmation = array('redirect' => esc_url(home_url('/producten/filters/brandstof/diesel/materiaal/kunststof/toepassing-filter/mobiel/')));
} else {
$confirmation = "Geen producten gevonden aan jouw criteria";
}
}
GFCommon::log_debug( __METHOD__ . '(): finished.' );
return $confirmation;
}
But I cant seem to get it to work, I have the feeling i'm missing something but I can't find it :/
You can find my Gravity Forms log here: http://pastebin.com/hm5RYpyZ.
Help will be greatly appreciated.
Best Regards,
Dylan Smit