Can Admin Only Fields actually be Admin Only?

27 posts by 5 authors in: Forums > CMS Builder
Last Post: February 23, 2011   (RSS)

By zip222 - October 26, 2010

When setting up a section editor, you can specify for a field to be "Admin Only" - the problem is that this also includes Editors. Is there a way for it to actually be Admin Only?

Re: [zip222] Can Admin Only Fields actually be Admin Only?

By Jason - October 27, 2010

Hi Zip

You can do this by changing CMS Builder's code slightly.

Go into cmsAdmin/lib/menus/default/edit_functions.php

Part was down the page you'll see this code:

// special cases: skip fields if:
if (@$fieldHash['adminOnly'] && !$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']) { continue; } // skip admin only fields


Change it to this:

// special cases: skip fields if:
if (@$fieldHash['adminOnly'] && !$CURRENT_USER['isAdmin'] ) { continue; } // skip admin only fields


This will mean that only admins can see the admin only fields. No editors will be able to view them in any section.
NOTE: If you upgrade CMS Builder, it will overwrite this change and you'll need to make it again.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Can Admin Only Fields actually be Admin Only?

By zip222 - October 27, 2010

Perfect. Thanks.

Re: [zip222] Can Admin Only Fields actually be Admin Only?

Are there any plans for this be an integrated option for a future release Jason?

I have plenty of instances where I need exactly this capability.

Kind regards

Paul

Re: [Pixels & Beats] Can Admin Only Fields actually be Admin Only?

By Jason - November 17, 2010

Hi Paul,

This is a feature that we'll consider for a future release.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Can Admin Only Fields actually be Admin Only?

Great news. Thanks for the update :)

Re: [Pixels & Beats] Error occuring with above solution

By Jason - December 17, 2010

Hi Paul,

Please fill out a [url http://www.interactivetools.com/support/]2nd Level Support Request[/url] and I'll take a look.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Error occuring with above solution

Done. Many thanks Jason.

Re: [Pixels & Beats] Error occuring with above solution

For anyone else with this problem Jason kindly sorted this out for me. Here is his reply:

Hi Paul,

I got this working for you. You were right, because of the changed code, the default value and field name were not part of the $_REQUEST array. I added an "@" to line 335 (in: cmsAdmin/lib/menus/default/save.php) to suppress the warning. The only issue is that the default value won't be added to the database when added by a user that is not an administrator.

Hope this helps.
Jason




Thanks Jason!!