So I have few articles in my menu which are for registered users only. I want them to be visible for everyone but if the user is not logged-in once he clicks on the menu I want him get redirected to the login page.. I saw this tutorial: Auto redirect guests to login but it seems outdated, in joomla 3.3 I can't find any "alias" menu item type. Is there any alternative for that? Iam using Joomla 3.3.1 with Community Builder. -Thank you.
-
There is certainly an alias menu type, it's down at the bottom of the list. Also this is why we have "show unauthorized" also known as "register to read more" .. you just have to be thoughtful about how you manage it. – Elin Jul 18 '14 at 03:12
-
Just as a comment about redirecting, you have to think hard about what the proper http status is to send in that case and you have to consider (assuming you care) whether it looks like a bait and switch to Google. so you should really make sure to use nofollow on those menu iinks. – Elin Jul 18 '14 at 10:33
-
I decided to go with with an extra login module in the "registered only" pages, so no redirect needed at all. – DiyanDesigns Jul 18 '14 at 12:12
1 Answers
There are two ways you could do this really. One is through code and the other is through the administrators panel. I'm assuming based on the question you are interested in the back end solution.
This involves creating two unique menu items with the same name (alias' would need to be different). One which is only visible to logged in users, which points to the component view desired. The second menu is only visible to guests, and will point to the user log in component view with a redirect url set to component view you wish them to be redirected to.
I attached a link below to an article explaining how to only show menu items to guests and have them hide when users are logged in.
http://docs.joomla.org/How_do_you_hide_something_from_logged_in_users%3F
- 1,873
- 1
- 12
- 14
-
Aw I just realized that I could just do that, but I already used a code solution, I slightly modified this answer: [link](http://stackoverflow.com/a/10753780/3657701) and it works but It shows the login module in every single page, So I might use your solution. Thank you for the answer. :) – DiyanDesigns Jul 17 '14 at 18:05