Field access to authors only
3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 17, 2019 (RSS)
Hello
I know that a field can be accessed by Everyone (user) or Editor only or Admin only, by choosing any of these options from the Advanced Options section from the Field Editor of this specific field. I wonder whether there is an option a field to be accessed by Author only (including of course at the same time Editor and Admin) and not by Viewers.
Kind regards
Andreas Lazaris
By robin - January 15, 2019
HI Andreas,
Setting a field to allow author access but not viewer access is not possible with the current CMS. However you can do it with a plugin. I've attached a simple plugin that allows you to restrict fields to authors but not viewers.
Note:
The field permission should be set to "Everyone" or they wont have access anyway.
The plugin has an array at the top that you can edit (code example just below this paragraph). "test" and "test2" are table sections. The sub-arrays containing "field1", "field3" etc. are field names. Change the table section names to your desired tables and the field names to the fields you want to hide from viewers.
$GLOBALS['authorOnlyField']['tableFields'] =
array( 'test' => array('field1','field3'),
'test2' => array('field2', 'field4')
);
Hope that helps. Please let me know any questions. Thanks,
Robin
Programmer
interactivetools.com