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

How to prevent user from creating top level pages?


Go to End


9 Posts   3672 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