web design, England, Britain, UK, belgium
 
Ulti Clocks content

How to make a login link Joomla 1.5

JOOMLABOTTOM sand How to make a login link with Joomla 1.5 and show user name
user, login, add, username, link, template, logout, php, use, jfactory, menu, echo, bit, interactivity, joomla, users, appropriately, style, suitable, position, store, getuser, greet, logged, section, place, provide, variable, guest, www, latest, item, screen, updated, code, asked, regularly, forums, manager, select

Home Joomla - VirtueMart Joomla & VM How To's How to make a login link Joomla 1.5

zon

09

aug

How to make a login link Joomla 1.5
  • Joomla 1.5
  • com_user

How to make a login link in Joomla 1.5 is asked quite regularly in forums.
Here's how to do it and add a bit of interactivity with the user.


joomla login link menu

Code updated 18.10.2010 to latest J1.5-21


The first way is to add a menu item to the login screen.
In the Menu Manager select "New" and type "External Link".
The url to use is http://www.yoursite.com/index.php?option=com_user&view=login



You can also add it directly in your template at a suitable position and style it appropriately -
<!--login link-->
<div id="loginlink">
<a href="http://www.yoursite.com/index.php?option=com_user&view=login">Login </a>
</div>
<!--end login link-->

If we want to add a bit of user interactivity then we first need to get the users name with a JFactory call and store it in a variable which we place in the php section of the template -
$username =& JFactory::getUser();

Then we can use this to greet the user if they are logged in and also provide a logout link.
<!--login link-->
<div id="loginlink">
<?php

$username =& JFactory::getUser();
if ($username->guest) {
echo '<a href="http://www.yoursite.com/index.php?option=com_user&view=login" >Login</a>';
} else {
$name = $username->get('username');
echo 'Hi ' . $name . ' - <a href="http://www.yoursite.com/index.php?option=com_user&task=logout" >Logout</a>';
}
?>
</div>
<!--end login link-->




Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! Slashdot! Technorati! StumbleUpon! Spurl! Newsvine! Furl! Fark! Yahoo! Netvouz! Mister-Wong! RawSugar! Ma.gnolia! Squidoo! DZone! Swik!
Laatste aanpassing op vrijdag 29 april 2011 10:08
 

Add your comment

BoldItalicUnderlineStrikethroughSubscriptSuperscriptEmailImageHyperlinkOrdered listUnordered listQuoteCodeHyperlink to the Article by its id
Very HappySmileWinkSadSurprisedShockedConfusedCoolLaughingMadRazzEmbarrassedCrying or Very SadEvil or Very MadTwisted EvilRolling EyesExclamationQuestionIdeaArrowNeutralMr. GreenGeekUber Geek
Your name:
  The word for verification.
Lowercase letters only with no spaces.

The word for verification.<br/>Lowercase letters only with no spaces.
Word verification:

Titel:
Comment:
Comments (14)
Login Link for Joomla (actually logging in)
14 dinsdag 09 augustus 2011 09:52
Mathias
Try this:

http://joomlacode.org/gf/project/login_protocol

This allows logging in by GET protocol, which means you can actually log in by klicking the link.

J!1.5 and J!1.7
s
13 woensdag 03 augustus 2011 06:47
s
Thank you so muchhh!!
12 zaterdag 18 juni 2011 01:25
j3n
Thanks for the very useful tutorial!!! Very Happy
um
11 donderdag 13 januari 2011 18:30
Brynn
How do I get the program in the first place? Is it free?
Thanks,
Mr. Green
Verry nice tutorial
10 woensdag 29 december 2010 12:47
emxource
Very nice tutorial, its sound very useful

thankyou...

www.emxource.com
"your development resource partner"

www.uaejobszone.com
Exactly What i was looking for
9 donderdag 16 december 2010 20:35
Oliver
This is Perfect...Thanks for the post
Great
8 maandag 29 november 2010 12:47
Lath
it's what i am seeking for... thanks......
A slightly different view
7 woensdag 11 augustus 2010 13:44
Jonas
Nice work - just what I needed. But somehow the spec must have changed - com_user&view=logout gives me an error while com_user&view=login seems more right (brings you to the user component where you will find a Logout button).

Also, I needed a little extra - namely a link to the user's data in order for the user to change password and so on. In DNN you click the name and I find this to be a intuitive solution. Here's the complete code snippet for this:


<!--login link-->
<div id="loginlink">
<?php
if ($username->guest) {
echo '<a href="/index.php?option=com_user&view=login">Login</a>';
} else {
$name = $username->get('name');
echo 'Hi <a href="/index.php?option=com_user&view=user&layout=form">' . $name . '</a> - <a href="/index.php?option=com_user&view=login">Logout</a>';
}
?>
</div>
<!--end login link-->
TExt box not showing up
6 woensdag 23 juni 2010 03:32
Snow
The Text box and the login button are not showing up.

please help.

Thanks!
it does not show name and it gives error on log out
5 dinsdag 30 maart 2010 21:14
lele
hi, guys! I really need this to work. I love it, think it's great, but when I log in, it does not show my name, it keeps showing Login. and when I click logout it shows the 505 joomla error page. Also, I don't know if I put this $username =& JFactory::getUser(); in the right place - in the first baseurl . '/templates/' . $this->template;
artxComponentWrapper($document);
$username =& JFactory::getUser();
?>) .

Is that right?

thank you all so much!
Its really nice
4 vrijdag 13 november 2009 06:25
Divyesh
Hey
Its working fine work nice
Thanks,
Well done!
3 vrijdag 23 oktober 2009 18:29
Surfer
Nice work!

Helped me fix a problem! Thank you!
@Matt
2 vrijdag 04 september 2009 19:30
GJC (admin)
Thanks!
Line fixed....
Typo
1 vrijdag 28 augustus 2009 15:43
Matt
should be "com_user&view=logout" on the 5th line from the bottom - just to save headaches should somebody copy paste this

Our Recommended Reading

For those interested in extending their knowledge of Joomla! & VirtueMart, Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.


Joomla! Social Networking with JomSocial
Joomla! Social Networking
with JomSocial

by Kwasi Boateng & Beatrice A. Boateng.
Joomla! 1.5 Multimedia
Joomla! 1.5 Multimedia
by Allan Walker.


Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide
Joomla! Template Design: 2nd Edition
Create your own professional-quality
templates with this fast, friendly guide
by Tessa Blakeley Silver.
Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

object-oriented-javascript-applications-libraries
Object-Oriented JavaScript by
Stoyan Stefanov gives you a very
comprehensive grounding in
the latest Javascript techniques.

Read the review
Joomla! Web Security
Joomla! Web Security
by Tom Canavan.

Joomla 1.5 Top Extensions Cookbook
Joomla 1.5 Top Extensions Cookbook by
Suhreed Sarkar is an ideal and concise round up of the extensions available for the Joomla! system.

Read the review

Latest Articles

Paypal Donation

If you use this module on your site please donate a small amount.
Any donation amount appreciated.

VM Live Product Search

Recommended Reading

For those interested in extending there knowledge of Joomla! & VirtueMart Packt Publishing has an excellent range of help & how to books.
Listed below are some I can recommend.
Simply click on the images to be taken directly to their web shop.

Mastering Joomla! 1.5 Extension and Framework Development
Mastering Joomla! 1.5 Extension and
Framework Development : 2nd Edition

by James Kennard.
Read the review

Building job sites with Joomla!
Building job sites with Joomla!
by Santonu Kumar Dhar.
Learning Joomla! 1.5 Extension Development Learning Joomla! 1.5 Extension Development
by Joseph L. LeBlanc.
Read the review
Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart
by Suhreed Sarkar.

Read the review
Joomla! 1.5 Site Blueprints Joomla! 1.5 Site Blueprints
by Timi Ogunjobi.

Joomla! 1.5 JavaScript jQuery Joomla! 1.5 JavaScript jQuery
by Jose Argudo Blanco.
Read the review
Joomla! Social Networking with JomSocial Joomla! Social Networking with JomSocial
by Kwasi Boateng & Beatrice A. Boateng.

Joomla! 1.5 Multimedia Joomla! 1.5 Multimedia
by Allan Walker.

Joomla! Web Security Joomla! Web Security
by Tom Canavan.

Mastering Joomla! 1.5 Extension and Framework Development Mastering Joomla! 1.5 Extension and Framework Development : 2nd Edition
by James Kennard.

Joomla! Template Design: Create your own professional-quality templates with this fast, friendly guide Joomla! Template Design: Edition 2 - Create your own professional-quality templates with this fast, friendly guide
by Tessa Blakeley Silver.

Magento: Beginner's Guide
Magento: Beginner's Guide by William Rice
is a must for anyone trying the
open-source e-Commerce solution.

Read the review

JOOMLABOTTOM



How to make a login link Joomla 1.5



How to make a login link with Joomla 1.5 and show user name


user, login, add, username, link, template, logout, php, use, jfactory, menu, echo, bit, interactivity, joomla, users, appropriately, style, suitable, position, store, getuser, greet, logged, section, place, provide, variable, guest, www, latest, item, screen, updated, code, asked, regularly, forums, manager, select