This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Enecs
Enecs

Maybe something simple but it would be nice to have a permission so that certain roles can't delete content pages etc. We use October CMS not only for us developers but also for customer who know nothing of developing and for some reason they like to click every button there is.

I've created a new permission and this hides the button on the page itself but not in the sidebar but maybe this is usefull for other users also

taha.azzabi14703
taha.azzabi14703

Hi Can you please post an example of how hide a button on backend page based on permission user backend. thanks

Enecs
Enecs

I will search for it when i'm back home. The cms was updated so on the live site it's gone but normally I have a backup at home

Enecs
Enecs

Here is what i have done: In modules\cms\ServiceProvider.php you create an additional backend permission:

'cms.delete_content' => [
    'label' => 'cms::lang.permissions.delete_content',
    'tab' => 'cms::lang.permissions.name',
    'order' => 100
],

In modules\cms\lang{Your language here}\lang.php under permissions you add a new label:

'delete_content' => 'Delete website content files',

and then in modules\cms\controllers\index_content_toolbar.htm you put following code around the last button

<?php if ($this->user->hasAccess('cms.delete_content')): ?>

<?php endif ?>

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.