From eb96c42f6f55e7d4f02b5ac48d633d931cd7d8b4 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 10 Jul 2018 10:11:57 -0400 Subject: [PATCH] Check for new option to hide the contacts main list. Hide the main contacts list when they can only edit their contact. --- setup/adminMenus.php | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 2e79104..1a28ae1 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -29,25 +29,41 @@ * that structure here. * */ +$lockedToMember = apply_filters('glm_members_locked_to_member_id', false); +$enable_contact_edit_only = $this->config['settings']['enable_contact_edit_only']; -add_submenu_page( - $mainMenuSlug, - 'Contacts', - 'Contacts', - 'glm_members_edit_my_entity', - 'glm-members-admin-menu-contacts', - function() {$this->controller('contacts');} -); +if ( $lockedToMember && $enable_contact_edit_only ) { -// If a contact is logged in (ownEntity isn't false), add Contact Profile menu item -// they see the "My Contact" -if ($this->config['loggedInUser']['contactUser']) { add_submenu_page( $mainMenuSlug, 'My Contact Info', - '  My Contact Info', + 'My Contact Info', 'glm_members_edit_my_contact_info', 'glm-members-admin-menu-profile', function() {$this->controller('profile');} ); + +} else { + + add_submenu_page( + $mainMenuSlug, + 'Contacts', + 'Contacts', + 'glm_members_edit_my_entity', + 'glm-members-admin-menu-contacts', + function() {$this->controller('contacts');} + ); + + // If a contact is logged in (ownEntity isn't false), add Contact Profile menu item + // they see the "My Contact" + if ($this->config['loggedInUser']['contactUser']) { + add_submenu_page( + $mainMenuSlug, + 'My Contact Info', + '   My Contact Info', + 'glm_members_edit_my_contact_info', + 'glm-members-admin-menu-profile', + function() {$this->controller('profile');} + ); + } } -- 2.17.1