From: Steve Sutton Date: Tue, 28 Feb 2017 21:42:43 +0000 (-0500) Subject: Update for password field and date_created X-Git-Tag: v1.0.0^2~494 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=5eedc0580a2b617e6df98420fa245d08e128ae32;p=WP-Plugins%2Fglm-member-db-registrations.git Update for password field and date_created Getting password field working correctly and the date_created field to save on insert. --- diff --git a/classes/data/dataAccount.php b/classes/data/dataAccount.php index 0fe20ed..8c3c203 100644 --- a/classes/data/dataAccount.php +++ b/classes/data/dataAccount.php @@ -107,7 +107,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract */ $this->fields = array ( - + // ID 'id' => array ( 'field' => 'id', @@ -115,7 +115,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'view_only' => true, 'use' => 'a' ), - + // Is active flag (may be accessed or used) - default is true 'active' => array ( 'field' => 'active', @@ -123,7 +123,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'use' => 'a', 'default' => 1 ), - + // Account 'registered_by' => array ( 'field' => 'registered_by', @@ -131,7 +131,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => true, 'use' => 'a' ), - + // Account Primary Address 'member_id' => array ( 'field' => 'member_id', @@ -139,7 +139,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // First Name 'fname' => array ( 'field' => 'fname', @@ -147,7 +147,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Last Name 'lname' => array ( 'field' => 'lname', @@ -155,7 +155,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Organization 'org' => array ( 'field' => 'org', @@ -163,7 +163,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Title 'title' => array ( 'field' => 'title', @@ -171,7 +171,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Address 1 'addr1' => array ( 'field' => 'addr1', @@ -179,7 +179,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Address 2 'addr2' => array ( 'field' => 'addr2', @@ -187,7 +187,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // City 'city' => array ( 'field' => 'city', @@ -195,7 +195,7 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // State 'state' => array ( 'field' => 'state', @@ -203,39 +203,39 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - - // + + // 'zip' => array ( 'field' => 'zip', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'country' => array ( 'field' => 'country', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'phone' => array ( 'field' => 'phone', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'fax' => array ( 'field' => 'fax', 'type' => 'text', 'required' => false, 'use' => 'a' ), - + // Last used billing information - Also stored in each registration request 'bill_fname' => array ( 'field' => 'bill_fname', @@ -243,305 +243,307 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - - // + + // 'bill_lname' => array ( 'field' => 'bill_lname', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_org' => array ( 'field' => 'bill_org', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_title' => array ( 'field' => 'bill_title', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_addr1' => array ( 'field' => 'bill_addr1', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_addr2' => array ( 'field' => 'bill_addr2', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_city' => array ( 'field' => 'bill_city', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_state' => array ( 'field' => 'bill_state', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_zip' => array ( 'field' => 'bill_zip', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_country' => array ( 'field' => 'bill_country', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_phone' => array ( 'field' => 'bill_phone', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'bill_fax' => array ( 'field' => 'bill_fax', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'email' => array ( 'field' => 'email', 'type' => 'text', 'required' => true, 'use' => 'a' ), - + // Cryped password for login back into this account 'password' => array ( 'field' => 'password', - 'type' => 'text', - 'required' => 'true', + 'type' => 'password', + 'pw_type' => 'strong', + 'minLength' => 8, 'use' => 'a' ), - - // + + // 'email_ok' => array ( 'field' => 'email_ok', 'type' => 'checkbox', 'use' => 'a', 'default' => 0 ), - + // Is a member of the entity that owns the site 'is_member' => array ( 'field' => 'is_member', 'type' => 'checkbox', 'use' => 'a', 'default' => 0 - ), - + ), + // Pointer to GLM Associate member contact record if account is for a member contact 'contact_id' => array ( 'field' => 'contact_id', 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'contacts', - 'p_field' => 'id', - 'p_static' => true, + 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'contacts', + 'p_field' => 'id', + 'p_static' => true, 'required' => true, 'use' => 'lgneud' ), - - // + + // 'contact_fname' => array ( 'field' => 'contact_fname', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_lname' => array ( 'field' => 'contact_lname', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_org' => array ( 'field' => 'contact_org', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_title' => array ( 'field' => 'contact_title', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_addr1' => array ( 'field' => 'contact_addr1', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_addr2' => array ( 'field' => 'contact_addr2', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_city' => array ( 'field' => 'contact_city', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_state' => array ( 'field' => 'contact_state', 'type' => 'text', 'required' => '', 'use' => 'a' ), - - // + + // 'contact_zip' => array ( 'field' => 'contact_zip', 'type' => 'text', 'required' => '', 'use' => 'a' ), - - // + + // 'contact_country' => array ( 'field' => 'contact_country', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_phone' => array ( 'field' => 'contact_phone', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_fax' => array ( 'field' => 'contact_fax', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_email' => array ( 'field' => 'contact_email', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'contact_email_ok' => array ( 'field' => 'contact_email_ok', 'type' => 'checkbox', 'use' => 'a', 'default' => 0 ), - - // + + // 'guardian' => array ( 'field' => 'guardian', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'emer_contact' => array ( 'field' => 'emer_contact', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'emer_phone' => array ( 'field' => 'emer_phone', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'med_history' => array ( 'field' => 'med_history', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'allergy_med' => array ( 'field' => 'allergy_med', 'type' => 'text', 'required' => false, 'use' => 'a' ), - - // + + // 'date_created' => array ( 'field' => 'date_created', 'type' => 'datetime', - 'use' => 'a' + 'use' => 'a', + 'default' => 'NOW()' ), - - // + + // 'notes' => array ( 'field' => 'notes', 'type' => 'text', 'required' => false, 'use' => 'a' ), - + // IP Address of user computer and timestamp 'user_trace_info' => array ( 'field' => 'user_trace_info', @@ -549,11 +551,30 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + ); } -} + public function checkOther($r, $a) + { -?> \ No newline at end of file + // Only run these tests for insert or update + if (!($a == 'i' || $a == 'u')) { + return $r; + } + + if ( $a == 'i' ) { + $r['fieldStore']['date_created'] = 'NOW()'; + } + + // If the password is empty then remove from fieldStore so it is not wiped out + if ( trim( $r['fieldData']['password'] ) == '' ) { + unset( $r['fieldStore']['password'] ); + } + + // Required + return $r; + } + +} diff --git a/models/admin/registrations/accounts.php b/models/admin/registrations/accounts.php index 2f8d2d5..cba13cc 100644 --- a/models/admin/registrations/accounts.php +++ b/models/admin/registrations/accounts.php @@ -154,6 +154,7 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $account = $this->updateEntry( $this->accountID ); if ( $account['status'] ) { + //echo '
$account: ' . print_r( $account, true ) . '
'; $accountUpdated = true; // Retrieve the Edit Entry again $account = $this->editEntry( $this->accountID ); @@ -168,7 +169,8 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount break; case 'delete': - break; + $oldAccount = $this->deleteEntry( $this->accountID, true ); + $view = 'account'; default: $accounts = $this->getList(); diff --git a/views/admin/registrations/edit.html b/views/admin/registrations/edit.html index 87287f6..7e6aac2 100644 --- a/views/admin/registrations/edit.html +++ b/views/admin/registrations/edit.html @@ -1,9 +1,27 @@ {include file='admin/registrations/header.html'} - Return to Account List + Return to Account List {if $option == 'edit' || $option == 'update'} Delete this Account +
+
+

Cancel

+

+
+
+

WARNING:

+

+ Clicking the "Delete this Account" button above will + delete all of the data and images associated with this contact. + +

+

+ Once deleted, this information will no longer be available and cannot be retrieved! +

+
+

Edit Account {else}

Add new Account @@ -20,19 +38,19 @@ {if $haveAccount} - + {else} {/if} - {if $haveAccount} {/if} @@ -53,12 +71,12 @@ - + @@ -66,7 +84,7 @@ @@ -74,7 +92,7 @@ @@ -82,7 +100,7 @@ @@ -90,7 +108,7 @@ @@ -98,7 +116,7 @@ @@ -106,7 +124,7 @@ @@ -114,7 +132,7 @@ @@ -122,7 +140,7 @@ @@ -130,7 +148,7 @@ @@ -138,7 +156,7 @@ @@ -146,17 +164,17 @@ - + @@ -164,7 +182,7 @@ @@ -172,7 +190,7 @@ @@ -180,7 +198,7 @@ @@ -188,7 +206,7 @@ @@ -196,7 +214,7 @@ @@ -204,7 +222,7 @@ @@ -212,7 +230,7 @@ @@ -220,7 +238,7 @@ @@ -228,7 +246,7 @@ @@ -236,7 +254,7 @@ @@ -244,15 +262,25 @@ - + @@ -273,12 +301,12 @@ - + @@ -286,7 +314,7 @@ @@ -294,7 +322,7 @@ @@ -302,7 +330,7 @@ @@ -310,7 +338,7 @@ @@ -318,7 +346,7 @@ @@ -326,7 +354,7 @@ @@ -334,7 +362,7 @@ @@ -342,7 +370,7 @@ @@ -350,7 +378,7 @@ @@ -358,7 +386,7 @@ @@ -366,7 +394,7 @@ @@ -374,7 +402,7 @@ @@ -390,7 +418,7 @@ @@ -398,7 +426,7 @@ @@ -406,7 +434,7 @@ @@ -414,7 +442,7 @@ @@ -422,7 +450,7 @@ @@ -444,6 +472,23 @@