Last active
August 29, 2015 14:21
-
-
Save Deaner666/4dd5c87a9a98d8522628 to your computer and use it in GitHub Desktop.
Pre-populate a Ninja Forms Tier field from a URL parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ninja_forms_field', 'wpm_handle_http_query_string' ); | |
function wpm_handle_http_query_string( $data ) { | |
if($data['label']=='Tier' && get_query_var('tier')) { | |
foreach ($data['list']['options'] as $key => $value) { | |
if($value['value'] == get_query_var('tier')) { | |
$data['list']['options'][$key]['selected'] = 1; | |
} | |
} | |
} | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment