Now providing array of capability defaults for creating capabilities
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 17:30:41 +0000 (13:30 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 20 May 2015 17:30:41 +0000 (13:30 -0400)
activate.php

index 34e2bd2..9b3d679 100644 (file)
@@ -334,22 +334,22 @@ class glmMembersPluginActivate extends glmPluginSupport
         // For each role object
         foreach ($roleObjects as $key => $role) {
 
-//if ( isset($role->capabilities[$capability])) {
-//$role->remove_cap($capability);
-//}
-
-            // Check if the role exists in list of editable roles and capability
-            // does not exist
+            // Check if the role exists in list of editable roles and
+            // the capability does not exist
             if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
 
-                // Check for default value
+                // Check if a default value has been specified in the $default array
                 $enabled = false;
-                if (isset($default[$role['name']])) {
-                    $enabled = $default[$role['name']];
+                if (isset($default[$role->name])) {
+
+                    // It has, so use that
+                    $enabled = $default[$role->name];
+
                 }
 
                 // Add the role
                 $role->add_cap($capability, $enabled);
+
             }
         }
     }