0

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é Vullioud Mar 13 '16 at 20:45
3

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, privacy policy and cookie policy

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