1
BentFX
login/account control line?
  • 2008/1/4 0:06

  • BentFX

  • Just popping in

  • Posts: 9

  • Since: 2007/12/26


I'm working on a theme and I want to have a single line in the header that either has a username/password form if the user is not logged in, or links to the users account info if they are logged in.

This is what I've got...
<{if $xxsomethingxx}>
  <
form action="user.php" method="post">
    <{
$lang_username}>:&nbsp;<input type="text" name="uname" size="13" maxlength="12" value="<{$usercookie}>">&nbsp;
    <{
$lang_password}>:&nbsp;<input type="password" name="pass" size="10" maxlength="32">
    <
input type="hidden" name="op" value="login">
    <
input type="submit" value="<{$lang_login}>">
  </
form>
<{else}>
<!-- 
links to user account controls -->
<{/if}>


the if/else/endif works fine, except I don't know what variable to test against to see if the user is logged in.

Also I don't know how to access $lang_username & $lang_password from outside of the login template... Someone help me out? :pitiful:

I'm sure this has been discussed, but I couldn't find an answer in the search.

Thanks in advance.

BFX

2
3lr0n
Re: login/account control line?
  • 2008/1/4 6:42

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


<{if !$xoops_isuser}>
 <
form action="user.php" method="post">
    <{
$lang_username}>:&nbsp;<input type="text" name="uname" size="13" maxlength="12" value="<{$usercookie}>">&nbsp;
    <{
$lang_password}>:&nbsp;<input type="password" name="pass" size="10" maxlength="32">
    <
input type="hidden" name="op" value="login">
    <
input type="submit" value="<{$lang_login}>">
  </
form>
<{else}>
<!-- 
links to user account controls -->
<{/if}>
Spanish Overclocking Community xoops based site : www.overclocking.es

3
BentFX
Re: login/account control line?
  • 2008/1/4 9:17

  • BentFX

  • Just popping in

  • Posts: 9

  • Since: 2007/12/26


Thanks Greatly!!!

Works like a champ. And, seeing as how my site has only english content, multilingual navigation controls are silly anyway.

4
BentFX
Re: login/account control line?
  • 2008/1/4 9:21

  • BentFX

  • Just popping in

  • Posts: 9

  • Since: 2007/12/26


YAHHH!!!!

$xoops_isadmin works too!!!

5
3lr0n
Re: login/account control line?
  • 2008/1/5 13:36

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Check here for a list of smarty variables
Spanish Overclocking Community xoops based site : www.overclocking.es

6
BentFX
Re: login/account control line?
  • 2008/1/11 22:35

  • BentFX

  • Just popping in

  • Posts: 9

  • Since: 2007/12/26


Thanks for the link 3lr0n.

I also found what I think is the best resource... turn on smarty debugging in Preferences->General Settings. It's way good

7
mboyden
Re: login/account control line?
  • 2008/1/13 15:47

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


$xoops_isadmin only works if you are an admin. $xoops_isuser is the one to use because every logged in user is a user, but every logged in users is NOT an admin. So, the code posted above is what most everyone uses to do what you wanted.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

Login

Who's Online

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


Members: 0


Guests: 115


more...

Donat-O-Meter

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

Latest GitHub Commits