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

How to make a login link Joomla 1.5

GJC Web Design Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help sand How to make a login link with Joomla 1.5 and show user name
login, user, add, username, link, jfactory, logout, menu, use, php, interactivity, echo, joomla, bit, template, store, appropriately, style, users, variable, logged, provide, guest, position, greet, section, getuser, place, index, screen, manager, select, item, forums, asked, regularly, type, external, option, view

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

Sun

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




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
  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&view=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!
Last Updated on Friday, 04 September 2009 19:29 Read : 7633 times
 
Comments (4)
Its really nice
4 Friday, 13 November 2009 06:25
Divyesh
Hey
Its working fine work nice
Thanks,
Well done!
3 Friday, 23 October 2009 18:29
Surfer
Nice work!

Helped me fix a problem! Thank you!
@Matt
2 Friday, 04 September 2009 19:30
GJC (admin)
Thanks!
Line fixed....
Typo
1 Friday, 28 August 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

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:
Subject:
Comment:

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.

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! Web Security Joomla! Web Security
by Tom Canavan.

Mastering Joomla! 1.5 Extension and Framework Development Mastering Joomla! 1.5 Extension and Framework Development
by James Kennard.

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

GJC Web Design Joomla & VirtueMart how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help

A collection of help articles and coding examples for Joomla & Virtuemart

Belgium, VirtueMart & Joomla Web Design England UK Britain & Germany

Joomla, VirtueMart, how to, tips, tricks, coding examples, html, php, tutorial, 101, useful hints, help



How to make a login link Joomla 1.5



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


login, user, add, username, link, jfactory, logout, menu, use, php, interactivity, echo, joomla, bit, template, store, appropriately, style, users, variable, logged, provide, guest, position, greet, section, getuser, place, index, screen, manager, select, item, forums, asked, regularly, type, external, option, view