Setting Area Permissions
Permalink
We are running a site where we want to give users the ability to control a set of pages, but we want to have certain custom block types always on the page and not deletable via the UI. We create the page as the user signs up so is it possible to lock those blocks in an area so that they cannot be deleted ?
You could also do this with Page Type Defaults.
Go into the dashboard, click on 'Pages and Themes', then hit the Defaults button. Add your sidebar blocks and set the permissions for them. Then click 'setup on child pages' if necessary. Publish that. Then, any new pages created using that Page Type, will have those blocks and those permissions.
And another way, in case you are using a single page which doesn't use a Page Type. Add the blocks in the single page template. So for instance, if you wanted an Auto Nav block on the page, then when you are creating your single page view, you can add the following code:
as an example...
Jon
Go into the dashboard, click on 'Pages and Themes', then hit the Defaults button. Add your sidebar blocks and set the permissions for them. Then click 'setup on child pages' if necessary. Publish that. Then, any new pages created using that Page Type, will have those blocks and those permissions.
And another way, in case you are using a single page which doesn't use a Page Type. Add the blocks in the single page template. So for instance, if you wanted an Auto Nav block on the page, then when you are creating your single page view, you can add the following code:
$bt = BlockType::getByHandle('autonav'); $bt->controller->displayPages = 'top'; $bt->controller->orderBy = 'display_asc'; $bt->controller->displaySubPages = 'all'; $bt->controller->displaySubPageLevels = 'all'; $bt->render('view');
as an example...
Jon
I've personally not messed with permissions programatically, but this might give you a headstarthttp://www.concrete5.org/documentation/developers/permissions/conte...
Jon