Clearing and resetting administrator capabilities for plugin
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 17:46:06 +0000 (13:46 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 17:46:06 +0000 (13:46 -0400)
activate.php

index 9b3d679..59a9270 100644 (file)
@@ -100,6 +100,7 @@ class glmMembersPluginActivate extends glmPluginSupport
             // Add user capabilties
             $this->addRoleCapability('glm_members_edit',
                 array(
+                    'administrator' => true,
                     'author' => false,
                     'contributor' => false,
                     'editor' => true,
@@ -108,6 +109,7 @@ class glmMembersPluginActivate extends glmPluginSupport
             );
             $this->addRoleCapability('glm_members_configure',
                 array(
+                    'administrator' => true,
                     'author' => false,
                     'contributor' => false,
                     'editor' => false,
@@ -116,6 +118,7 @@ class glmMembersPluginActivate extends glmPluginSupport
             );
             $this->addRoleCapability('glm_members_info',
                 array(
+                    'administrator' => true,
                     'author' => false,
                     'contributor' => false,
                     'editor' => true,
@@ -334,6 +337,11 @@ class glmMembersPluginActivate extends glmPluginSupport
         // For each role object
         foreach ($roleObjects as $key => $role) {
 
+            // Uncomment to reset capabilities
+            if ( isset($role->capabilities[$capability])) {
+                $role->remove_cap($capability);
+            }
+
             // Check if the role exists in list of editable roles and
             // the capability does not exist
             if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {