Skip to content

error Using $this when not in object context #11

@Lefthandmedia

Description

@Lefthandmedia

Hi,
i'm seeing an error in my server logs 'Using $this when not in object context in'.
this is a line in a cached snippet. Don't know from what snippet but i suspect it is quickbar that's why i'm posting here.

function elements_modsnippet_74($scriptProperties= array()) {
global $modx;
if (is_array($scriptProperties)) {
extract($scriptProperties, EXTR_SKIP);
}
if (!$modx->user->hasSessionContext('mgr') ) return '';

$resource = $modx->resource;
$user = $modx->getUser();
$membership = $user->getUserGroups();

$policies = $resource->findPolicy();

if(count($policies)){
    $checkPolicy = $this->hasAccess($policies,$membership);        
    if(!$checkPolicy){
        return '{"error":"Access is denied"}';
    }
}

$defaultQuickBarCorePath = $modx->getOption('core_path').'components/quickbar/';
$quickbarsCorePath = $modx->getOption('quickbar.core_path',null,$defaultQuickBarCorePath);
$quickbar = $modx->getService('quickbar','QuickBar',$quickbarsCorePath.'model/quickbar/',$scriptProperties);

$modx->regClientCSS($quickbar->parse($modx->getOption('quickbar.css',null,$modx->getOption('assets_url') . 'components/quickbar/retro.css')));
return $quickbar->getChunk('quickbar',array('mgr_url' => MODX_MANAGER_URL));
}

The line in question is

 $checkPolicy = $this->hasAccess($policies,$membership);  

This happens when a user from a specific usergroup tries to view a page that is within a resourcegroup with that this group HAS the right to see.

Anyone else experiences this?

LHM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions