How to test a user role on public pages?


We created a static page for reviewers and we put the link in the menu file (navbar.tpl).
We want that only reviewers can see this menu. So I added this code:
{if $isUserLoggedIn && $isValid.Reviewer.$journalId}
<a href="{url page=“pages” op=“view”}/reviewers">{translate key=“ubspecific.howSubmitReview”}

The test “isUserLoggedIn” works fine but the test “isValid.Reviewer.$journalId” works only on pages that need authentications and not on public pages such as home page or articles pages.

Is there a way to test a user role on public pages ?

Thanks in advance for your answer.

Hi @hcl,

I’d suggest using the Validation::isReviewer() function.

Alec Smecher
Public Knowledge Project Team

It works fine!
Thanks a lot.