1
mramsey
Login block - Please help!!!
  • 2003/12/3 2:58

  • mramsey

  • Just popping in

  • Posts: 33

  • Since: 2002/3/8 3


Hi All,

I’ve added the login block at the top of the (theme.html) page and everything is working fine.

<form action="<{$xoops_url}>/user.php" method="post"><{$block.lang_username}><input type="text" name="uname" size="12" value="<{$block.unamevalue}>"><{$block.lang_password}><input type="password" name="pass" size="12"><input type="hidden" name="op" value="login" /><input type="submit" value="Login"></form>

Please I need some help from you to add a simple code which if no user logon to the site will display the login block above and if the user is login will replace the login block above and will display his username.

It is basically as the normal login block, after the user login to the site, the login block disappeared and it replaced with “user menu”

Can anyone help me to write this code?

Many thanks.

2
MadFish
Re: Login block - Please help!!!
  • 2003/12/3 4:11

  • MadFish

  • Friend of XOOPS

  • Posts: 1056

  • Since: 2003/9/27


Hi

I can't help you with code, but couldn't you could achieve the same thing through the groups system ?

ie make the login block visible to anonymous users but invisible to registered users; and make the user menu invisible to anonymous users, but visible to registered users. Give both blocks the same weighting and they should appear in the same place.

3
Stewdio
Re: Login block - Please help!!!
  • 2003/12/3 4:41

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


Insert this code on a single line in your table on the top of your page where you want it to be displayed. I think this will work, I havn't actually tried it yet.


<{if $xoops_isuser}> Welcome, <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a>
<{else}>
<a href="<{$xoops_url}>/register.php">Register!</a> or <{/if}>
<{if $xoops_isuser}> <a href="<{$xoops_url}>/user.php?op=logout">logout</a>
<{else}>
<a href="<{$xoops_url}>/user.php">log in</a> <{/if}>


Cheers!



4
mramsey
Re: Login block - Please help!!!
  • 2003/12/3 4:42

  • mramsey

  • Just popping in

  • Posts: 33

  • Since: 2002/3/8 3


Thank you for your reply.

But, how can I add both block at to top of the header page?

Not at the left or right column.

Thanks.

5
mramsey
Re: Login block - Please help!!!
  • 2003/12/3 4:50

  • mramsey

  • Just popping in

  • Posts: 33

  • Since: 2002/3/8 3


Thank you so much,

This code is working fine

:)

6
Stewdio
Re: Login block - Please help!!!
  • 2003/12/3 4:54

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


I'm not sure how to display blocks outside of the areas where they are normally displayed. The only thing the above code is good for, is for insertion into a table into your custom or modified theme.html files for more customisation without the use of an entire block and it's code.

If I am following you correctly, do you want to just have a simple login option along the top of your page, and a user name for users that are logged in? If so, then just copy paste that code into a table in your theme.html file, which will be in the root of the thmes folder under the same name, if you follow what I mean.

The code I showed you isn't block code, it's the content in which the block uses to display the desired results, which in this case is the login area. Although minor, there is a difference with the terminology.

Hope this helps,
Cheers!



7
Gamut
Re: Login block - Please help!!!
  • 2003/12/3 10:51

  • Gamut

  • Just popping in

  • Posts: 34

  • Since: 2002/1/5 1


mramsey,

I think the following code should do the trick. It worked for me.

<{if $xoops_isuser}>Welcome <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a>
<{else}>
<form action="<{$xoops_url}>/user.php" method="post">
<input type="text" name="uname" size="12">&nbsp; Username
<input type="password" name="pass" size="12">&nbsp; Password
<input type="hidden" name="op" value="login">
<input type="hidden" name="xoops_redirect" value="<{$xoops_requesturi}>">
<input type="submit" value="Login"></form>
<{/if}>


Cheers,

Gamut

Login

Who's Online

177 user(s) are online (108 user(s) are browsing Support Forums)


Members: 0


Guests: 177


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