nblgeoweb VIP
Total posts: 178
07 Apr 2015 10:32

In the default template for the filter module, a filter for a field is displayed even if the current user doesn't have view access to that field.

I added the following line to the foreach ($filters AS $filter) block in the filter template to disable displaying that filter if the user couldn't see that field:

<?php if(!in_array($filter->params->get('core.field_view_access'),JFactory::getUser()->getAuthorisedViewLevels())) continue; ?>

Cobalt generally shows everything for a field except it's value when a user does not have view access. In this case I don't want the user to even see that the field exists. I added similar code to the record list and record templates to hide them as well. If you are in a similar situation, the above code is a very easy way to accomplish this.


nblgeoweb VIP
Total posts: 178
07 Apr 2015 15:22

Here's the code to use in a article listing or article template:

<?php if(!in_array($field->params->get('core.field_view_access'), JFactory::getUser()->getAuthorisedViewLevels())) continue; ?>
Powered by Cobalt