From: Steve Sutton Date: Tue, 25 Oct 2016 14:56:28 +0000 (-0400) Subject: Updating the glmUser and glmMembersCaps. X-Git-Tag: v2.8.1^2~2^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=8ec9aeb904b4f38625e6266d66b07d8dcf8a0f44;p=WP-Plugins%2Fglm-member-db.git 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. --- 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;