Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://www.gravityhelp.com/forums/topic/conditional-redirect-2#post-80796
- // change the 1 here to your form ID if you are not using form 1
- add_filter('gform_confirmation_1', 'conditional_confirmation', 10, 4);
- function conditional_confirmation($confirmation, $form, $lead, $ajax){
- // change the 1 here to your field if the unit numbers not field 1
- $url = get_bloginfo(); // set a reasonable default in case we forget a unit
- switch($lead[1]) {
- case 'P0003':
- $url = "http://google.com/?q=P0003";
- break;
- case 'P0097':
- $url = "http://www.ask.com/whatever";
- break;
- case 'P0224':
- $url = "http://maps.google.com/?q=P0224";
- break;
- case 'P0438':
- $url = "http://google.com/?q=P0003";
- break;
- case 'P0883':
- $url = "http://example.com/some-page/";
- break;
- case 'P0925':
- $url = "http://example.org/somthing-for-P0925";
- break;
- case 'P0956':
- $url = "http://web.com/whatever-for-unit-956";
- break;
- case 'P0976':
- $url = "http://google.com/";
- break;
- case 'P1173':
- $url = site_url();
- break;
- case 'P1179':
- $url = "http://whitehouse.gov/help";
- break;
- case 'P1454':
- $url = site_url() . '/whichever-url-for-this-unit/';
- break;
- case 'P3461':
- $url = "http://yahoo.com/news";
- break;
- }
- $confirmation = array('redirect' => $url);
- return $confirmation;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement