By nethyperon on
I want to add a link to the site header 'Create account or login', like you see on most wiki sites. The page.tpl.php template doesn't seem to have any info on the user.
Is there anybody who can tell me how to do this?
I want to add a link to the site header 'Create account or login', like you see on most wiki sites. The page.tpl.php template doesn't seem to have any info on the user.
Is there anybody who can tell me how to do this?
Comments
Any idea?
I dont understand what you means with that!? What do you want to do
exactly? For a link to create account or login you can simply point to
'user/register' or 'user' appended to your $base_url.
<?php global $base_url; echo $base_url.'/user/register'; ?>or even simpler
<a href="./user/register">Login</a>All information about a user (when logged on) is available through
the global variable $user.
Only
You would only want this to appear if you were not logged in. How does one test to see if you are an authenticated user or not?
if ($user->uid > 0) { //
-----------------------------------------
CompuBase, websites and webdesign
Login recipe
This idea looks cool....
Is there a way to make Login/logout appear in the primary link or any other menu item conditionally toggling?
Thanks for your help.
Login/Logout Links
To add the Login/MyAccount link to your primary nav (or any drupal menu)
add a new link to /user and label it as you want (i.e. Login)
When a user is logged in, it will be transformed into 'My Account'.
To add a logout link
add a link to your menu that points to /logout
label it as you want (i.e. Logout)
This link will only display if you are actually logged in.
peace,
michael
Web Developer : RockRiverStar.com : Philadelphia, PA
Technical Architect : Philadelphia, PA
Hi pelicani, can you explain a little further?
I've been trying to find this answer, can you show me some code snippet and where this code should go? Does this go into a module's hook_menu() function?
no longer working
I was trying to do this on a dv6 install and it doesn't work. boo-urns.
The solution does still work on my install of dv5.7
Technical Architect : Philadelphia, PA
actually
there is a module that does this for you.
http://drupal.org/project/loginmenu
Technical Architect : Philadelphia, PA
/user does not hide the link
/user does not hide the link after login, instead use /user/login
@ prateek_t2 Thanks, It
@ prateek_t2 Thanks,
It works.
Other way round?
Since a uid greater than 0 would mean that the user is in fact logged in the code should read:
if ($user->uid > 0) {
// show welcome text
}
else {
// show the login url
}
oh
right
I've created a module to do this
see http://drupal.org/node/486618
Where do the codes go?
Hi guys :D
I'm really new to all this and I don't have much experience with HTML or whatnot in general [just in the process of learning~], so I have a really newbie question XD I'm wondering where you would put in all those codes that have been posted above (^) ...
I've got the Account Menu module but I'm not sure how to work with it to make the Login an actual link in the header >____<
Thank you all in advance! ^^
Solution for Drupal 6
You can just add a "user/login" link into the menu instead of just "user" to have it as a login link when the user is not logged in and it would then disappear when he/she is logged in.
Same thing for register link
You can also create a link to 'user/register' which will display a link to the registration page only if the user is anonymous (not logged in) just like the 'login' link mentioned above.
deuhhhhh!
And it was as simple as that! thank you! I was wondering how to get rid of the "login" link when user is logged in! Where is my brain?
Drupal 7
User menu
add item with path user/login
Thank you so much buddy.
Hi markbannister ,Thank you so much buddy.It works for all pages, earlier solutions by other people was working for only home page in my case.thanks :-)
Here's my complete code for D6