From dfe93607c7bf4e57f5a97b596a89ab7c63366926 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 18 Dec 2017 16:51:38 -0500 Subject: [PATCH] Check for custom fields to be active. Need to check for custom fields to be active before calling the ajax. --- models/front/registrations/registration.php | 1 + views/front/registrations/registration.html | 43 ++++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index 1a57e23..bd6b3f3 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -346,6 +346,7 @@ // Compile template data $templateData = array( + 'customfieldActive' => apply_filters( 'glm-members-customfields-plugin-active', false ), 'regEventId' => $regEventId, 'page' => 'registration', 'haveCart' => $haveCart, diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 05a72cb..42e289f 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -326,6 +326,7 @@ var appAccountUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=account var ajaxUrl = '{$ajaxUrl}?action=glm_members_admin_ajax'; var thisPageUrl = '{$thisUrl}'; var nextPageUrl = '{$thisUrl}?page=cart'; +var customFieldActive = '{$customfieldActive}'; var app = { Models: { Front: {}, Admin: {} }, Collections: { Front: {}, Admin: {} }, @@ -344,25 +345,29 @@ var app = { } }, setCustomFieldsForm: function( reg_event_id, record_id, target ){ - var formData = { - 'action': 'glm_members_admin_ajax', - 'glm_action': 'customFieldsFront', - 'option': 'displayForm', - 'fid': 'glm_reg_customfields_reg_event_attendee_' + reg_event_id, - 'recordId': record_id, - 'parentFormId': '', - 'formData': false - }; - $.ajax({ - type: 'POST', - url: ajaxUrl, - data: formData, - encode: true, - dataType: 'text' - }) - .done( function( formHtml ) { - $(target).html( formHtml ); - }); + if ( customFieldActive ) { + var formData = { + 'action': 'glm_members_admin_ajax', + 'glm_action': 'customFieldsFront', + 'option': 'displayForm', + 'fid': 'glm_reg_customfields_reg_event_attendee_' + reg_event_id, + 'recordId': record_id, + 'parentFormId': '', + 'formData': false + }; + $.ajax({ + type: 'POST', + url: ajaxUrl, + data: formData, + encode: true, + dataType: 'text' + }) + .done( function( formHtml ) { + $(target).html( formHtml ); + }); + } else { + return false; + } }, {if $regEvent.time_specific.value} timeSpecific: true, -- 2.17.1