login / logout link

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
DuJam
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 178
Joined: Sun Jun 25, 2006 11:20 am
Location: Limburg, Belgium
Contact:

login / logout link

Post by DuJam » Tue Jul 21, 2009 6:28 pm

Greetings!

In my 1.0 installation I added a text link in my template which shows 'sign in' to redirect the user to a login page. After the user logged in, the text link changed in 'sign out' and the name of the user was shown after the link. It worked perfect with this code:

Code: Select all

            <?php if( $my->id ) 
              { 
              echo '<a class="login" href="index.php?option=com_login&Itemid=848&action=logout">sign out</a>'; 
              } else {
              echo '<a class="login" href="index.php?option=com_login&Itemid=847&action=login">sign in</a>';
			                }
            ?>
            <?php if ( $my->id ) { echo $my->name; } ?>
But in my new 1.5 installation it does not work anymore.

Does anybody know why and how to solve it?

Many tnx!
Last edited by DuJam on Sun Jul 26, 2009 9:03 am, edited 1 time in total.
http://www.dutchjamaica.com - A Dutch View on Jamaica

kanoorani
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 186
Joined: Sat Mar 01, 2008 1:36 pm

Re: login / logout link

Post by kanoorani » Thu Jul 23, 2009 6:52 am

Change your code to:

Code: Select all

<?php 
$userid=$_SESSION["__default"]["user"]->id;
$username=$_SESSION["__default"]["user"]->name;
            if( $userid!=0 ) 
              { 
              echo '<a class="login" href="index.php?option=com_login&Itemid=848&action=logout">sign out</a>'; 
              } else {
              echo '<a class="login" href="index.php?option=com_login&Itemid=847&action=login">sign in</a>';
                         }
            ?>
            <?php if ( $userid!=0 ) { echo $username; } ?>
K.A.Noorani
Lead Developer of Twitterface
http://www.twitterface.com

DuJam
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 178
Joined: Sun Jun 25, 2006 11:20 am
Location: Limburg, Belgium
Contact:

Re: login / logout link

Post by DuJam » Sun Jul 26, 2009 9:02 am

Hi kanoorani,

Many thanks, this one works perfect again!
Still don't see why the old script did not work in the new version, but whatever...
Learning a lil day by day :)

Thnx again!
http://www.dutchjamaica.com - A Dutch View on Jamaica

lrdeepak
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sun Jun 20, 2010 10:32 am
Location: India
Contact:

Re: login / logout link

Post by lrdeepak » Sat Aug 04, 2012 10:01 am

i just want to change word "login" to signin" & "logout" to "Signout"

Also was cbloing mod to be at position-0 for beez_20 template but get following screen

[img]
untitled.JPG
[/img]

Please let me know if you have any idea to do it
You do not have the required permissions to view the files attached to this post.
Regards
Deepak Labde

lrdeepak
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Sun Jun 20, 2010 10:32 am
Location: India
Contact:

Re: login / logout link

Post by lrdeepak » Mon Aug 13, 2012 4:40 pm

can close this topic as problem is solved
Regards
Deepak Labde


Locked

Return to “Templates for Joomla! 1.5”