Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Trying to fix code to go back php versions


Go to End


2 Posts   635 Views

Avatar
an_Eskimo

Community Member, 10 Posts

27 November 2013 at 3:45pm

can anyone please help here, when I run this code, the editors for this are not able to see the sitetree. All that comes up is "There has been an error".

The error that comes up is: "[Error] Uncaught Exception: Object->__call(): the method 'organisation' does not exist on 'Page'"

This is coming from the line marked with stars:

public function canEdit($member = null) {
$return = false;

// If parent::canEdit() returns true, then the user is an admin so they're allowed to edit. We don't need to do
// any further checking.
// If parent::canEdit() returns false, then we want to continue checking whether the Member is part of the group
// of editors that this ResourcePage is associated with
$return = parent::canEdit($member);
if(!$return) {
// Get the Member object ($member could be instanceof Member, or ID, or null)
if(is_numeric($member)) $member = Member::get()->byID($member);
else $member = Member::currentUser();
if($member && $member->isInDB()) {

// Check whether this Member is in the organisation editing group
*** if($this->Parent && $this->Parent->Organisation() && $this->Parent->Organisation()->Group()) {
if($member->inGroup($this->Parent->Organisation()->Group(), true)) {
$return = true;
}
}
}
}

return $return;
}

any assistance in this matter would be greatly appreciated!

Avatar
an_Eskimo

Community Member, 10 Posts

27 November 2013 at 5:25pm

For those who are interested, I solved this quite simply (After three, yes, three hours of fighting with it).

All I did was add a try catch around the if statement causing the issue and it has fixed it.