How can I check if the user has access to any particular article? I was looking at $user->authorise() method but it looks like it's only for core edit, edit own and some other permissions.
-
It's common for people who are new to the site to ask questions and then never accept an answer. As a result, their newer questions tend to be ignored. Reputation points are the currency of this site, and accepting an answer is like tipping a waiter/waitress :-) please valid my anwser if it was resolving your question– Pierre-André VullioudMar 13, 2016 at 20:45
1 Answer
You can see an exemple of this check in this file
modules/mod_articles_latest/helper.php
https://github.com/joomlagovbr/joomla-3.x/blob/master/modules/mod_articles_latest/helper.php
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
if (in_array($item->access, $authorised))
{
// We know that user has the privilege to view the article
// do something here
}
Where $item is your article