I followed this tutorial about ACL - http://community.joomla.org/blogs/community/1252-16-acl.html
To make everything clear: this is what I need:
- having a menu item that is linking to an article
- a user enters (not logged yet) the web site (it does not matter if the user is already registered or not)
- this user should see the menu item
- the user clicks on the menu item
- if the user is NOT logged in - the user is asked to enter the username/pass
- if the user is logged in -> goto 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
// 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;
}
to
// 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;
}
How can I override that code and avoid hacking core files?
Or maybe there is a more elegant solution?
Thanks.