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.
*
* @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;