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.

General Questions

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

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

Trying to fix code to go back php versions


2 Posts   270 Views


27 November 2013 at 3:45pm Community Member, 10 Posts

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!


27 November 2013 at 5:25pm Community Member, 10 Posts

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.