From 8f3cba86cf702ece4bac1bfbe7e318d73861c1d1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 18 Dec 2017 09:47:37 -0500 Subject: [PATCH] I have the custom fields being saved now. Calling the apply_filters for the submit of custom fields when the registrant is being added or updated by way of ajax. --- gulpfile.js | 2 +- models/admin/ajax/regFront/registrant.php | 19 ++++++++++++++----- views/front/registrations/registration.html | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 17baa4d..d9f8e11 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,7 +1,7 @@ var gulp = require('gulp'), concat = require('gulp-concat'), uglify = require('gulp-uglify'), - // jshint = require('gulp-jshint'), + jshint = require('gulp-jshint'), plumber = require('gulp-plumber'); // notify = require('gulp-notify'); diff --git a/models/admin/ajax/regFront/registrant.php b/models/admin/ajax/regFront/registrant.php index 12fa5b7..37b16ea 100644 --- a/models/admin/ajax/regFront/registrant.php +++ b/models/admin/ajax/regFront/registrant.php @@ -344,11 +344,6 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations '%s' ); $accountId = $this->wpdb->insert_id; - $queryParams = parse_url( $modelData['customFields'] ); - - // Store the custom field data - $_REQUEST = $queryParams; - apply_filters( 'glm-members-customfields-form-submit', '', 'glm_reg_customfields_reg_event_attendee_' . $modelData['reg_event'], $accountId, true); // Here validated would be false. // Because it is new account. } @@ -500,6 +495,20 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations $registrant['reg_time_text'] = $regTimeText; } + // Parse str for the custom field data + parse_str( $modelData['customFields'], $queryParams ); + + // Store the custom field data + $_REQUEST = $queryParams; + trigger_error(print_r($_REQUEST,1)); + apply_filters( + 'glm-members-customfields-form-submit', + '', + 'glm_reg_customfields_reg_event_attendee_' . $modelData['reg_event'], + $regRequestRegistrantId, + true + ); + return $registrant; } diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index e698e4c..9c8ff3f 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -357,6 +357,7 @@ var app = { 'parentFormId': '', 'formData': false }; + console.log( 'formData:', formData ); $.ajax({ type: 'POST', url: ajaxUrl, -- 2.17.1