From 3e3c98012aaf8820a82d3df94facd9623e05b3bf Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 20 May 2015 13:30:41 -0400 Subject: [PATCH] Now providing array of capability defaults for creating capabilities --- activate.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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); + } } } -- 2.17.1