In this tutorial, we'll show how to hide content form logged in Joomla users.
Why would you want to hide information from logged in users? The most common reason to do this that you want to encourage visitors to join the site. Then, if a visitor logs in, they no longer need to see the "join now!" content.
We're going to show you how to do this in both Joomla 2.5 and Joomla 3. The setup in Joomla 3 is a little easier.
- From the Administrator side, go to Users > Groups.
- If you're using Joomla 2.5, you'll need to add a new Guest group that has Public as its parent. In Joomla 3, just verify that it's already there.
Viewing Access Levels
- Go to Users > Access levels.
- In Joomla 2.5, you'll need to add a corresponding access level called Guest. In Joomla 3, just verify that it's already there.
Set the Guest User Group
- From the Users Screen, click on the Parameters icon.
- Look for the Guest User Group and set it to Guest. In Joomla 3, verify that it's already done for you.
Add an Article for Non-Logged In Visitors
- Go to Content > Article Manager > Add New Article.
- Add the title and content you want the non-logged-in users to see.
- Set the Access to Guest.
- Set Featured to Yes, because we want this article on the home page, we'll s
- Click Save & New.
Add an Article for Logged-in Visitors
- Enter the title and body of article to be seen by your logged-in users.
- Set the Access to Registered and the Featured to Yes. Then Save & Close from the toolbar.
Verify: Step 1 - Add a User
- From Users->User Manager->Add New User
- enter the login information of a new user: Name, Login Name, Password (twice) and email address.
- Click on the Assigned User Groups and verify that it defaults to Registered.
- Click Save & Close.
Verify: Step 2 - View Home Page While Not Logged In
- Browse to the public side of the site.
- Notice that the home page has the article that was set to Public access.
Verify: Step 3 - View Home Page While Logged In
- Enter the User name and password of the user you created into the Login Form.
- You'll now see the article on the home page that was set for Registered access, and NOT the article whose Access was Guest.
You can use this same process with menu items and modules for even more content hiding and showing. This technique is valuable for any site where you're encouraging people to join: Paid content sites, tutorial sites, dating sites, homeowner association sites, church membership sites. etc.