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

How to prevent user from creating top level pages?


Go to End
Reply


9 Posts   2614 Views

Avatar
Munhoz

Community Member, 3 Posts

6 June 2010 at 1:58am

Try this code in pages.php, it allows only for Administrators...

public function onBeforeWrite() {
if(!Permission::check('ADMIN')){
if (!$this->ParentID) {
       user_error('Cannot create new page at top level', E_USER_ERROR);
    exit();
   }
   }
parent::onBeforeWrite();
}

Go to Top