Hiding a field from a section editor

9 posts by 3 authors in: Forums > CMS Builder
Last Post: November 19, 2009   (RSS)

By gkornbluth - November 16, 2009 - edited: November 16, 2009

Hi all,

I have a (checkbox) field in a membership section editor that indicates if a member was a founding member of the organization.

Since this information will never change, and is only used for generating reports, my client would like to either:

A) Completely hide that field from the section editor, or
B) Make the field uneditable by anyone

Any insights?

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [Damon] Hiding a field from a section editor

By gkornbluth - November 16, 2009 - edited: November 18, 2009

Thanks Damon.

I already tried that, but since many of the folks that modify the section are classified as "editors" the field shows up for them and is editable.

Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Hiding a field from a section editor

By Dave - November 17, 2009

There's nothing that really does that right now and I can't think of a quick and simple work-around.

I could tell where to modify the code to make it some admin only fields weren't available to editors (who are kind of like section admins).

Would that work? If not we'd have to get more creative.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Hiding a field from a section editor

By gkornbluth - November 17, 2009 - edited: November 18, 2009

Thanks Dave,

That would probably work, and might be a nice addition to the advanced options somewhere down the road. That would keep those well intentioned "editors" from getting into too much trouble.

Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Hiding a field from a section editor

By Dave - November 18, 2009

Hi Jerry,

Here's some code changes you could make to make adminOnly fields not available to editors (who are section Admins)

Be sure to make backups and test any changes. Also remember to not upgrade without copying your custom changes over. One way to remember this is to create a file in /cmsAdmin/ called DO_NOT_UPGRADE.readme that lists your custom code changes so you'll remember. (That's what we do).

- Open /cmsAdmin/lib/menus/default/edit_functions.php
- Search for "!$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']" and remove the crossed out code:
if (@$fieldHash['adminOnly'] && !$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']) { continue; } // skip admin only fields

- Open /cmsAdmin/lib/menus/default/save.php
- Search for "!$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']" and remove the crossed out code (two lines):
if (@$fieldSchema['adminOnly'] && !$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']) { continue; } // skip admin only fields
if (@$fieldSchema['adminOnly'] && !$CURRENT_USER['isAdmin'] && !$GLOBALS['hasEditorAccess']) { continue; } // skip admin only fields

Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Hiding a field from a section editor

By gkornbluth - November 18, 2009 - edited: November 18, 2009

Thanks Dave,

Seems like it will work. I'll try it in a bit.

Any chance that this could become another choice on the admin advanced options menu somewhere down the road?

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Hiding a field from a section editor

By Dave - November 18, 2009

Yes, down the road we'll want to have thinks like group permissions and more fine grained access control. But there's a lot of scenarios to consider for that so it would probably be the focus on an upgrade release by itself.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Hiding a field from a section editor

Worked like a charm.

Thanks

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php