1
kaper
Show user info ("who am I")
  • 2003/12/13 21:49

  • kaper

  • Just popping in

  • Posts: 75

  • Since: 2003/4/26


Hi,

Is it possible to display user's identity? I'd like do have my site display as who I am logged in (and something like "Guest" if I am not logged in).

(I took a look at blocks, but the Site Info shows only webmasters and I didn't notice anything else useful).

Kaper

2
tom
Re: Show user info ("who am I")
  • 2003/12/13 22:05

  • tom

  • Friend of XOOPS

  • Posts: 1359

  • Since: 2002/9/21


Try putting the following in your theme.html where you want it:

<{if $xoops_isuser}> Welcome <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a>
<{else}> <a href="<{$xoops_url}>/register.php">Register</a> Domain.com!
<{/if}>

For users not logged in it says: Register yourdomain.com!

And for logged in user it says: Welcome username

You can change it to your liking.

Hope this is of help.

3
DonXoop
Re: Show user info ("who am I")

Here is another one. I scooped most of the code from a similar thread yesterday. I turned on the smarty debug to catch variable names I needed. It will print a Logout link if logged in otherwise place a Register link.

It checks their Inbox and will show a new message count in red if any otherwise just a link to the Inbox.

I put this in my theme.html file, actually it is a text file and I do an <{include ... }> so I can use it in other themes.

<{if $xoops_isuser}>
<a href="<{$xoops_url}>/user.php?op=logout">Bye</a> ·&nbsp;User: <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a> ·
<{php}>
/* ******* User Details if Logged In ******* */
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
<{/php}>
<{if $msgcount > 0}>
<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>
<{else}>
<a href="<{$xoops_url}>/register.php">Register</a>
<{/if}>

Login

Who's Online

127 user(s) are online (90 user(s) are browsing Support Forums)


Members: 0


Guests: 127


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