silverlight513
silverlight513

Reputation: 5666

Joomla article permissions, show alternative text for user without access

I am trying to get an article to show some text like "You do not have permission to view this article" when a user doesn't have the correct access level.

Currently the article just shows no content if the user doesn't have the right permissions. how would I go about showing content for a user who doesn't have access?

Upvotes: 0

Views: 149

Answers (1)

Craig
Craig

Reputation: 9330

Joomla's normal behaviour for any resource that a user doesn't have viewing permissions for is to display a message. e.g. this is the default message in Joomla 2.5 in the default template: Joomla 2.5 Default Not Authorised Message - Front End

and this a Joomla 3.2 example:

Joomla 3.2 Default Not Authorised Message - Front End

If you're seeing a page with nothing in the content area then (as @Elin suggests) it's likely that your template doesn't have a message block. Specifically your looking for a line like this in you templates index.php code:

<jdoc:include type="message" />

When Joomla renders the page it replaces this jdoc tag with any system messages such as the not authorised one.

If you don't like the wording of the message you can over-ride the language key JERROR_ALERTNOAUTHOR using the Extensions->Language Manager->Language Overrides feature, just remember to select "Site" before creating a new over-ride as this is a front-end message.

Upvotes: 2

Related Questions