The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu May 04, 2006 5:17 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Mar 09, 2006 5:46 pm
Posts: 139
I have a menu I created for my users.  If the user is not registered, I want to show a few menu items (login, register). But if the user is logged in, I want those menu items hidden, and new ones shown (profile, blog, logout).  At the moment, there is an option in the EDIT MENU ITEM that allows me to show items to the PUBLIC, REGISTERED or SPECIAL. But none that show only if NOT registered.

For example, login is one of my menu items. Once the user logs in, I want that menu item hidden. There is no reason for someone logged in to see that link.

I want to avoid using SPECIAL, because all my users will be public (and I dont want to give them AUTHOR access and such).


Can someone tell me how to do this?


Last edited by jabbamonkey on Fri May 05, 2006 12:09 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu May 04, 2006 5:32 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Dec 02, 2005 5:10 pm
Posts: 52
Maybe I am just misunderstanding what you are saying, but you might want to use the Login module instead of a menu link. I think this automatically 'removes' itself after login and turns on the bit which greets the user and the ability to log out.

You could go into the Menu Manager and create a new menu. Then set that to only display if someone is registered.

Hope this helps.


Top
 Profile  
 
PostPosted: Thu May 04, 2006 5:40 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Mar 09, 2006 5:46 pm
Posts: 139
The menu contains a bunch of items, so using the login module wont work (in fact, it will pull apart the entire top header table I created in my template if I throw the module there).

Basically, if not logged in, I need to show only these:

LOGIN 
REGISTER

If logged in, I need to hide the above, and to show:

PROFILE
BLOG
LOGOUT
(and anything else I add later on)


Top
 Profile  
 
PostPosted: Thu May 04, 2006 5:47 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Dec 02, 2005 5:10 pm
Posts: 52
I would still try the same technique of building a second menu to only display once the visitor has logged in. It seems like that would be the easiest way and the public would still be able to do whatever they are allowed to do.

Wait... duh. I think I see the problem. You are still going to see the original log in menu. Right? Perhaps the log in is only shown on the front page? I know that means whenever they go 'home' they would see it... Wow, this is a bit tougher. Is there no other place you could put the log in module? It seems like you might be needing to do some php coding to get that menu to go away...

If I have any further thoughts / code examples I will pass them along.


Top
 Profile  
 
PostPosted: Thu May 04, 2006 6:33 pm 
Joomla! Ace
Joomla! Ace

Joined: Thu Aug 18, 2005 2:39 am
Posts: 1056
Public is everyone who is not logged in.  The way the ACL works at present there is no way to selectively remove displayed links for accounts that have higher permissions.  Essentially you can restrict up but you cannot restrict down. 

The Login Module is the only easy way to get the Logged In vs Logged Out display.  However there is another way that may suit your needs.  Create a manual link in the template using the Log In/Log Out PHP code.  This is something I did on a Website and it works just fine however I have explained it before and some people could not get it to work for reasons that I could not sort out.  Probably due to the fact that I am not a coder just a manipulator.

This is the code in my template:
Code:
<td > 
<?php
if   ($my->id) {
   echo ( "Logged in: "); ?> <?php echo $my->username;?>
   <?php echo ("<a href='".sefRelToAbs('index.php?option=logout')."'>(Log OUT) </a>");?>
   <?php
   }
 else {
    ?>
<?php echo ("<a href='".sefRelToAbs('index.php?option=com_login')."'>LogIn </a>");?>
<?php   }
?>
</td>


Failing this method it will be necessary to adapt your template layout to manage the Login Module and the Menu Module, probably the User Menu, in a column so they can appear as one.

Cheers

_________________
Freedom is not free!
It is however Open Source.


Top
 Profile  
 
PostPosted: Thu May 04, 2006 6:35 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Mar 09, 2006 5:46 pm
Posts: 139
Cool. That's a good solution. I'll try this. Thanks.


Top
 Profile  
 
PostPosted: Fri May 05, 2006 12:08 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Mar 09, 2006 5:46 pm
Posts: 139
Here's what I did and it works great. Shows the LOGIN if they are not logged in. And shows my REGISTERED "usermenu" when they are logged in...

Code:
<?php
if   (!$my->id)
   {
       ?><span class="mainlevel-usermenu"><a href="<?php echo sefRelToAbs('index.php?option=com_login'); ?>">LOGIN</a></span><?php   
   }
?>
<?php mosLoadModules ( 'usermenu', -1); ?>


Top
 Profile  
 
PostPosted: Thu May 25, 2006 3:44 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jan 16, 2006 8:35 pm
Posts: 10
That's a great tip for showing the "logout" link only to registered users.

Does anyone know how to do this if you're using the SMF Bridge registration? The standard logout link there requires a session ID, so I don't know how to statically code the "logout" link in my template:

Code:
index.php?option=com_smf&Itemid=26&action=logout&sesc=c27f4ed35da32659e3d5f446d17c4d53


Top
 Profile  
 
PostPosted: Thu Sep 21, 2006 10:24 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Mar 31, 2006 11:50 am
Posts: 43
one question..
What file should I edit and where should put in the code above?

thx


Top
 Profile  
 
PostPosted: Thu Sep 21, 2006 11:05 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Mar 31, 2006 11:50 am
Posts: 43
camos wrote:
Create a manual link in the template using the Log In/Log Out PHP code. 


Could you please explain what file or where to put the code? thx


Top
 Profile  
 
PostPosted: Mon Jul 02, 2007 12:36 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Sep 08, 2006 1:42 pm
Posts: 44
In what file did you do this?
Zev

jabbamonkey wrote:
Here's what I did and it works great. Shows the LOGIN if they are not logged in. And shows my REGISTERED "usermenu" when they are logged in...

Code:
<?php
if   (!$my->id)
   {
       ?><span class="mainlevel-usermenu"><a href="<?php echo sefRelToAbs('index.php?option=com_login'); ?>">LOGIN</a></span><?php   
   }
?>
<?php mosLoadModules ( 'usermenu', -1); ?>



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 



Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group