1
gediminasbyt
Alternating Login/Logout

I would like to put a menu in my theme where one of the buttons would be Login/Logout (but not both on the same time) depending on wheather user is logged In or Not. When clicking on Login it should bring to login page. I still want to keep the main login box though. Can someone guide me through or put a snippet of code.

If it's hard, then at least I'd like to have a Logout button that disappears once user is Logged-Out.

Thanks in advance.

2
Shine
Re: Alternating Login/Logout
  • 2005/5/28 0:42

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


I suppose you know how to put in images within html pages (theme)

Here is the code which will show text. If you replace the text with images you're done
<{if $xoops_isuser}>&nbsp;<a href="<{$xoops_url}>/user.php?op=logout">Log Out</a>&nbsp;~&nbsp;<a href="<{$xoops_url}>/user.php">Account</a><{else}>&nbsp;<a href="<{$xoops_url}>/user.php">Log in</a>&nbsp;of&nbsp;<a href="<{$xoops_url}>/register.php">Register</a>&nbsp;<{/if}><br /> 
                      <{
$xoops_uname}>


Grtz., Shine

3
Catzwolf
Re: Alternating Login/Logout
  • 2005/5/28 2:10

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Sorry Shine,

Changed this around a little bit as it had a tiny mistake, I moved the <{$xoops_uname}> into the if Statement or It may have shown an error if xoops_user was not defined.

<{if $xoops_isuser}>
    <{
$xoops_uname}>&nbsp;<a href="<{$xoops_url}>/user.php?op=logout">Log Out</a>&nbsp;~&nbsp;<a href="<{$xoops_url}>/user.php">Account</a>
<{else}>
    &
nbsp;<a href="<{$xoops_url}>/user.php">Log in</a>&nbsp;of&nbsp;<a href="<{$xoops_url}>/register.php">Register</a>&nbsp;
<{/if}>

4
gediminasbyt
Re: Alternating Login/Logout

Thanks Catzwolf and Shine worked like a charm. Still trying to learn how XOOPS works. Thanks.

Gediminas

Login

Who's Online

115 user(s) are online (72 user(s) are browsing Support Forums)


Members: 0


Guests: 115


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits