1
alfredxz
username in the home page
  • 2003/11/13 15:55

  • alfredxz

  • Just popping in

  • Posts: 15

  • Since: 2003/2/11


hi,
i want to include in my home page a short "Welcome back, [username]" with the username that varies depending on which user logs in.
so i edited [theme]%2Ftheme.html and created a login box:


<?php if (!$xoops_isuser): ?>
<form action="<?php echo $this->_tpl_vars['xoops_url']; ?>
/user.php" method="post"><b>User: </b>
<input type='text' name='uname' value='username' size=7 maxlenght=20 onMouseOver="this.focus();" onFocus="if(this.value == 'username') this.value = '';">
<b>Pass: </b>
<input type="password" size="7" maxlenght=15 name="pass"/>
<input type="hidden" name="op" value="login" />
<input type="submit" value="login" /> 
<a href="<?php echo $this->_tpl_vars['xoops_url']; ?>
/register.php"><b>
Join</b></a>
</form>
<?php else: ?>
&nbsp;&nbsp;Welcome back, <b><?php echo $this->_tpl_vars['user_realname']; ?>
<?php endif; ?>

Unfortunately it only works while browsing the User Page, the other pages give a "Welcome back,." with no username.
What function shall i include to make it work???

2
hsalazar
Re: username in the home page
  • 2003/11/25 6:29

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


alfredxz:

This code will suffice (of course, add the necessary code for the login form):

<{if !$xoops_isuser}>
<!-- put here the login form -->
<{else}>
Hello, <{$xoops_uname}>
<{/if}>

This code goes in the theme.html file, most probably in the header, but you can in fact use the variable anywhere.

Now, if you NEED this to go in a block, please read

https://xoops.org/modules/newbb/viewtopic.php?topic_id=12057&forum=14#forumpost48232

Cheers.

3
alfredxz
Re: username in the home page
  • 2003/11/25 17:32

  • alfredxz

  • Just popping in

  • Posts: 15

  • Since: 2003/2/11


Thanks a lot!

It worked with:
<?php echo $this->_tpl_vars['xoops_uname']; ?>

4
Mithrandir
Re: username in the home page

We generally don't advise people to edit the compiled templates, but instead change the templates through the template editor in the admin menu

Login

Who's Online

221 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 221


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