Free Resources for Web Designers

Hide Content after Login in Joomla

Hide Content after Login in Joomla

This might seem like an unusual thing to do, but think about it… if you have a large banner module on your website asking people to create an account, why would you want this to be visible to users who are already registered?

Obviously it’s ideal to hide the module from registered users, and set it to only display for non-registered users, but how do we do this?

At one point this required a bit of customisation in the backend, but since the release of Joomla 3 it’s been made a bit easier. We will explain how to do this in both Joomla 2.5 and Joomla 3.

Until recently, Joomla offered only three different levels of access:

  • Public: for users without any login credentials
  • Registered: for those with a login account to the frontend
  • Special: for users with access to the backend

This made it simple to hide certain content from public users. All you had to do was set the access level of the content to Registered, thus blocking any non-logged in users from accessing it. But there wasn’t any straightforward option to do things the other way around, and make content exclusive to public users.

The way to get around this is to set up a new user group and access level for guests, and then assign it to the content. If you are using a recent version of Joomla 3, the user group and access level should already be set up for you, but it is best to check to make sure they have been set up.

Creating a User Group for Guest

Log in to your Joomla Administration panel and go to Users > Groups. If you are using Joomla 3, you should see that Guest has already been set up as a User Group. If not, we need to create it.

Click New and give your group a title (preferably Guest), and make sure Public is assigned as its parent.

User Groups in Joomla User Manager

Setting the Access Levels for the User Group

Next we need to set up the access level for our new user group. From the User Manager, click into Viewing Access Levels. Again, if you are using Joomla 3, you should see that Guest has already been set up. If not, we need to create it.

Click New and give the access level a title (use Guest again so that it doesn’t get confusing), and then tick Guest under the User Groups Having Viewing Access title.

Viewing Access Levels in Joomla User Manager

Set the Guest User Group

With the access level and user group set up, we need to set it as the default group that will be applied to non-logged in users. Click Parameters while still in the User Manager and set the Guest User Group to Guest.

Changing the Guest User Group in Joomla User Manager Parameters

Assigning a Module to the Guest User Group

With the above done correctly, you can now assign your content to the new user group. Find the content you want to make viewable to the Guest group, and then set the Access to Guest.

Your content will now only be visible to users who are not logged in!

Before you test this though, make sure you clear your browser’s cookies, and remember when testing your front end, that any element of your website will always be visible to a super user, so make sure you test this with a registered user.

Access in Joomla Administration

Show Content only for Guest Users in Joomla: Simplified

  • Go to User Groups and create a new group called Guest, and make this is a child of the Public group.
  • Then go to Viewing Access Levels and create a new access level called Guest. Click into the access level and make sure it is assigned to the Guest User Group.
  • Set the Guest User Group to Guest in the User Manager’s Parameters
  • Click into your content, and set the Access level to Guest.
  • Clear your cache, and done. Your content is now only visible to non registered users.

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.