pastvne
Bruce Decker
Alright gang, here's another one for the wiki. It just amazes me how flexible fabrik is and how simple it can be to do such complex things. It is such as well-conceived system and I just love working with it. On to the trick.
I have a table where an element holds the view level. The idea is that I want to only show certain records if a user is authorized for a view level in Joomla.
The answer I found was so simple and so powerful I wanted to share the trick in case there are others out there that could use it. I also think this would be an excellent add to the wiki docs under prefiltering and perhaps also referenced under the $my-> placeholder discussion.
To make this work, I just had to add this simple prefilter:
Prefilter:
Join=WHERE
Field=<name of element that holds the raw view level id>
Condition=IN
Value=
Type=Eval
Apply to= <as you see fit>
That's it. It's fast since the eval is done just once at the start of the query and so flexible.
Thanks Rob, Hugh, Robbie and all the rest for such a beautifully designed product.
-Bruce
I have a table where an element holds the view level. The idea is that I want to only show certain records if a user is authorized for a view level in Joomla.
The answer I found was so simple and so powerful I wanted to share the trick in case there are others out there that could use it. I also think this would be an excellent add to the wiki docs under prefiltering and perhaps also referenced under the $my-> placeholder discussion.
To make this work, I just had to add this simple prefilter:
Prefilter:
Join=WHERE
Field=<name of element that holds the raw view level id>
Condition=IN
Value=
Code:
$user = JFactory::getUser();
return implode(',',$user->getAuthorisedViewLevels());
Apply to= <as you see fit>
That's it. It's fast since the eval is done just once at the start of the query and so flexible.
Thanks Rob, Hugh, Robbie and all the rest for such a beautifully designed product.
-Bruce
Last edited: