Check for new option to hide the contacts main list.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 10 Jul 2018 14:11:57 +0000 (10:11 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 10 Jul 2018 14:11:57 +0000 (10:11 -0400)
Hide the main contacts list when they can only edit their contact.

setup/adminMenus.php

index 2e79104..1a28ae1 100644 (file)
  * 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',
-        '&nbsp;&nbsp;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',
+            '&nbsp;&nbsp;&nbsp;My Contact Info',
+            'glm_members_edit_my_contact_info',
+            'glm-members-admin-menu-profile',
+            function() {$this->controller('profile');}
+        );
+    }
 }