Siteconfig for content authors

In Silversripe 2.4.7, if you need to allow content authors to edit your site config settings, you need to click on the permission tab and give ‘Manage site settings’ to the right user. However, this doesn’t work on SS3.0. Here is our work around:

In your mysite/codes folder, create a new file called SiteConfigAdmin.php with the following content:

class SiteConfigAdmin extends CMSSettingsController {

static $url_segment = 'settings';
static $url_rule = '/$Action/$ID/$OtherID';
static $menu_priority = -1;
static $menu_title = 'Site configs';
static $tree_class = 'SiteConfig';

function canView($member = null) {
if($member==null) $member = Member::currentUser();
//only for content editor
if($member && $member->ID && $member->inGroup(MemberExtension::$contentEditor))
return true;
else return false;
}

}

and then run /dev/build, login the site as a content authors, you will see the ‘Site Configs’ menu on the left which points to the same page as ‘Settings’ when you login as the super admin.

This entry was posted in Silverstripe and tagged , , , , . Bookmark the permalink.