From: Steve Sutton Date: Tue, 10 Jul 2018 14:11:57 +0000 (-0400) Subject: Check for new option to hide the contacts main list. X-Git-Tag: v1.1.12^2~17 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=eb96c42f6f55e7d4f02b5ac48d633d931cd7d8b4;p=WP-Plugins%2Fglm-member-db-contacts.git Check for new option to hide the contacts main list. Hide the main contacts list when they can only edit their contact. --- 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');} + ); + } }