From: Steve Sutton Date: Mon, 9 Oct 2017 18:15:57 +0000 (-0400) Subject: Checking for validated account for registrant X-Git-Tag: v1.0.0^2~362 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=8cedce46eb0944d3335f044105be0e4ec31c58bb;p=WP-Plugins%2Fglm-member-db-registrations.git Checking for validated account for registrant When adding registrant need to check for the account validated field. Placing this into the model for the app. --- diff --git a/js/frontRegApp.js b/js/frontRegApp.js index af5d506..0a4faf4 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -222,6 +222,7 @@ app.Models.Front.RegRequestRegistrant = Backbone.Model.extend({ name: 'registrant', id: 0, account: 0, + validated: false, reg_event: 0, reg_class: 0, event_name: '', @@ -822,7 +823,9 @@ app.Views.Front.RegClass = Backbone.View.extend({ this.newRegAccount = new app.Models.Front.RegRequestRegistrant(); this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); - app.initFullCalendar(); + if ( app.timeSpecific === true ) { + app.initFullCalendar(); + } }, toggleClassOpen: function(){ @@ -936,7 +939,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ events: { 'click .glm-reg-level-registrant-delete': 'deleteOne', - //'click .glm-registrant-edit': 'editRegistrant', + 'click .glm-registrant-edit': 'editRegistrant', }, editRegistrant: function(){ diff --git a/js/models/front/regRequestRegistrant.js b/js/models/front/regRequestRegistrant.js index 605d14f..2e972eb 100644 --- a/js/models/front/regRequestRegistrant.js +++ b/js/models/front/regRequestRegistrant.js @@ -3,6 +3,7 @@ app.Models.Front.RegRequestRegistrant = Backbone.Model.extend({ name: 'registrant', id: 0, account: 0, + validated: false, reg_event: 0, reg_class: 0, event_name: '', diff --git a/js/views/front/regClass.js b/js/views/front/regClass.js index 14e182e..eeb6b32 100644 --- a/js/views/front/regClass.js +++ b/js/views/front/regClass.js @@ -136,7 +136,9 @@ app.Views.Front.RegClass = Backbone.View.extend({ this.newRegAccount = new app.Models.Front.RegRequestRegistrant(); this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); - app.initFullCalendar(); + if ( app.timeSpecific === true ) { + app.initFullCalendar(); + } }, toggleClassOpen: function(){ diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index ff36513..7719418 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -12,7 +12,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ events: { 'click .glm-reg-level-registrant-delete': 'deleteOne', - //'click .glm-registrant-edit': 'editRegistrant', + 'click .glm-registrant-edit': 'editRegistrant', }, editRegistrant: function(){ diff --git a/models/admin/ajax/regFront/registrant.php b/models/admin/ajax/regFront/registrant.php index 5a58b3c..4ef9668 100644 --- a/models/admin/ajax/regFront/registrant.php +++ b/models/admin/ajax/regFront/registrant.php @@ -280,7 +280,17 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations '%s' ); $accountId = $this->wpdb->insert_id; + // Here validated would be false. + // Because it is new account. } + $validated = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT validated + FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account + WHERE id = %d", + $accountId + ) + ); // Check for or create reg_request_registrant $regRequestRegistrantId = $this->wpdb->get_var( @@ -370,6 +380,7 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations ); } $regRequstRegistrant = $this->getEntry( $regRequestRegistrantId ); + $regRequestRegistrant['validated'] = $validated; echo json_encode( $regRequstRegistrant, JSON_NUMERIC_CHECK ); wp_die(); break; diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index 3698f00..1d747d2 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -204,7 +204,7 @@ if ( isset( $registrant['account'] ) && filter_var( $registrant['account'], FILTER_VALIDATE_INT ) ) { $accountData = $this->wpdb->get_row( $this->wpdb->prepare( - "SELECT fname,lname,email,addr1,addr2,city,state,zip,country + "SELECT fname,lname,email,addr1,addr2,city,state,zip,country,validated FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account WHERE id = %d", $registrant['account'] @@ -232,16 +232,16 @@ $registrant['account'] ) ); - $registrant['class_id'] = $classId; - $registrant['email'] = $email; - $registrant['addr1'] = $accountData['addr1']; - $registrant['addr2'] = $accountData['addr2']; - $registrant['city'] = $accountData['city']; - $registrant['state'] = $accountData['state']; - $registrant['zip'] = $accountData['zip']; - $registrant['country'] = $accountData['country']; - // echo '
$registrant: ' . print_r( $registrant, true ) . '
'; - $registrants[] = $registrant; + $registrant['class_id'] = $classId; + $registrant['email'] = $email; + $registrant['validated'] = $accountData['validated']; + $registrant['addr1'] = $accountData['addr1']; + $registrant['addr2'] = $accountData['addr2']; + $registrant['city'] = $accountData['city']; + $registrant['state'] = $accountData['state']; + $registrant['zip'] = $accountData['zip']; + $registrant['country'] = $accountData['country']; + $registrants[] = $registrant; } } } diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 287a0f4..d409d3d 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -65,10 +65,10 @@ <% if ( !time_specific ) { %>

Attend any time during event

<% _.each(reg_time, function(rTime){ %> -

- Maximum Registrants: <%= rTime.attendee_max %>
- Currently Available: <%= rTime.attendees_available %> -

+ <% if ( rTime.attendee_max > 0 ) { %> +

Maximum Registrants: <%= rTime.attendee_max %>
+ Currently Available: <%= rTime.attendees_available %>

+ <% } %> <% }); %> <% } else { %> <% } %> @@ -163,32 +163,36 @@ {* Template for registrant *}{literal} {/literal}