1

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.

1
  • 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 Mar 13, 2016 at 20:45

1 Answer 1

5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.