From: Steve Sutton Date: Tue, 31 Jul 2018 14:40:24 +0000 (-0400) Subject: Contact edit page updates. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=8e4b9682003873395e5c122eea864507781a416a;p=WP-Plugins%2Fglm-member-db-contacts.git Contact edit page updates. Switching the 'My Contact Info' menu to goto the contact edit model view. I'm adding a template variable for when an contact is editing their own record. contactEditOwnRecord. --- diff --git a/models/admin/contacts/index.php b/models/admin/contacts/index.php index fa127b7..88af86f 100644 --- a/models/admin/contacts/index.php +++ b/models/admin/contacts/index.php @@ -141,6 +141,7 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts $member_types = false; $contactUpdateError = false; $billingFieldResults = false; + $contactEditOwnRecord = false; $where = ''; @@ -161,6 +162,12 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts // If this is a logged in member user, then show their contacts only if (isset($this->config['loggedInUser']['contactUser'])) { + // Find out if the user has same contact id as the one being edited. + $contactID = $_REQUEST['contact'] - 0; + if ( $this->config['loggedInUser']['contactUser']['ID'] == $contactID ) { + $contactEditOwnRecord = true; + } + // if there's logged in contact user $contactUser = $this->config['loggedInUser']['contactUser']; if ($contactUser['ref_type'] = $this->config['ref_type_numb']['Member'] @@ -763,6 +770,7 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts 'contactsList' => $contactsList['list'], 'numbContacts' => $numbContacts, 'contactID' => $contactID, + 'contactEditOwnRecord' => $contactEditOwnRecord, 'contactInfo' => $contactInfo, 'newContactEmailExists' => $newContactEmailExists, 'newContactUsernameExists' => $newContactUsernameExists, diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 1a28ae1..d37bcee 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -40,7 +40,13 @@ if ( $lockedToMember && $enable_contact_edit_only ) { 'My Contact Info', 'glm_members_edit_my_contact_info', 'glm-members-admin-menu-profile', - function() {$this->controller('profile');} + function() { + define( 'GLM_MEMBERS_CONTACTS_MEMBER_MENU', true ); + $_REQUEST['member'] = $lockedToMember; + $_REQUEST['contact'] = $this->config['loggedInUser']['contactUser']['ID']; + $_REQUEST['option'] = 'edit'; + $this->controller('contacts', 'index'); + } ); } else { diff --git a/views/admin/contacts/edit.html b/views/admin/contacts/edit.html index f97a4df..9b2778c 100644 --- a/views/admin/contacts/edit.html +++ b/views/admin/contacts/edit.html @@ -81,7 +81,9 @@ {else} {if $contactUpdated}

Contact Updated

{/if} {/if} + {if !$contactEditOwnRecord} Delete this Contact + {/if}

Cancel