From: Chuck Scott Date: Wed, 20 May 2015 17:30:41 +0000 (-0400) Subject: Now providing array of capability defaults for creating capabilities X-Git-Tag: v1.0.0~17 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=3e3c98012aaf8820a82d3df94facd9623e05b3bf;p=WP-Plugins%2Fglm-member-db.git Now providing array of capability defaults for creating capabilities --- diff --git a/activate.php b/activate.php index 34e2bd21..9b3d6798 100644 --- a/activate.php +++ b/activate.php @@ -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); + } } }