I followed this tutorial about ACL - http://community.joomla.org/blogs/commu ... 6-acl.html
To make everything clear: this is what I need:
1. having a menu item that is linking to an article
2. a user enters (not logged yet) the web site (it does not matter if the user is already registered or not)
3. this user should see the menu item
4. the user clicks on the menu item
5a. if the user is NOT logged in - the user is asked to enter the username/pass
5b. if the user is logged in -> goto 6
6. after login is ok, the user can see the content of the article where the menu item was linked.
My aim is to have a menu item that would be visible for all users: logged in and not logged in. But when clicked - only logged in users can view the content where the menu item is pointing. In case the user is not logged in -> log in form should be displayed.
After following the above tutorial I got a menu item that is completely invisible for users that are NOT logged in.
How can I make the menu item to be visible for all, but need login to see content?
Thank you.
EDIT 1:
I just found this solution http://docs.joomla.org/Auto_redirect_guests_to_login
Is it the only solution? I have a huge tree menu structure. That means I need to have a clone of my huge menu... And everytime I change a menu item name - I should do it twice (in visible menu and in invisible menu).
Are there any other solutions without having 2 menus?
EDIT 2:
Found another solution (hacking core files).
This is when menu item is set to "public" but the article ACL is set to "registered"
components/com_content/views/article/view.html.php
from
Code: Select all
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
Code: Select all
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
// Redirect to login
$uri = JFactory::getURI();
$app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('Members please login to view this page. If you are not a member please <a href="/component/users/?view=registration">register here<a>'));
return;
}