Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pre_submission_handler_services_7($form){
- $form_id = 7;
- $form_raw = GFAPI::get_form($form_id);
- // Grab memberium tags from database
- global $wpdb;
- $memberiumtagsarray = $wpdb->get_results("SELECT * FROM memberium_tags WHERE category = '13' ORDER BY name ASC");
- // Grab checkbox fields from GFAPI
- $inputarray = $form_raw[fields][2][inputs];
- // Define array to be used for tags when theres a match
- $services = array();
- // Iterate through array looking for matches for checked boxes
- foreach ($inputarray as $key => $val) {
- $inputarray[$key][id] = "input_".str_replace(".", "_", $inputarray[$key][id]);
- if($_POST[$inputarray[$key][id]] !== NULL) {
- array_push($services, $memberiumtagsarray[$key]->id);
- }
- }
- // post the array as comma delimited into field 26
- $_POST["input_26"] = implode(", ",$services);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement