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

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

GJC Web Design UK 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 with Joomla 1.5 and show user name

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

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-->


Last Updated on Friday, 29 April 2011 10:08
 

Latest Articles

VirtueMart
Your Cart is currently empty.

Paypal Donation

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

VM Live Product Search

GJC Web Design UK 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|Joomla & VirtueMart Tips & How To's



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

|

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.