From 8ec9aeb904b4f38625e6266d66b07d8dcf8a0f44 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 25 Oct 2016 10:56:28 -0400 Subject: [PATCH] Updating the glmUser and glmMembersCaps. Placing these two into the function glmMembersUserCan. Setting up the glmUser as static variable that will be created only the first call for the function. This fixes an issue with network sites. --- classes/glmPluginSupport.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index 6ce8f5ab..d0a8cbf6 100644 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -498,15 +498,17 @@ function glmMembersInstallErrorsNotice() { * * @return boolean True if capability exists */ -$glmUser = wp_get_current_user(); -$glmMembersCaps = $glmUser->allcaps; function glmMembersUserCan( $cap, $permit ) { - global $glmMembersCaps; + static $glmUser; + if ( !$glmUser ) { + $glmUser = wp_get_current_user(); + } if (!$permit) { return false; } + $glmMembersCaps = $glmUser->allcaps; if (!isset($glmMembersCaps[$cap])) { return $permit; -- 2.17.1