1
rider
Display realname in template
  • 2005/4/27 23:39

  • rider

  • Just popping in

  • Posts: 56

  • Since: 2003/6/18


Can someone tell me the code for displaying the Real Name of a user in a template?

If I use <{$user.name}> I get the login but I want the Real Name to display, or fall back on the login if real name not available.

I'm trying to do a "Welcome XXX" type thing just to make the site a little more personal. I've got the Avatar displaying okay.

Better yet, is there a list of every code that XOOPS uses so that you can play around?

Thanks people.

2
Anonymous
Re: Display realname in template
  • 2005/4/27 23:45

  • Anonymous

  • Posts: 0

  • Since:


Look at this faq.

I guess it works the same way with

$thisUser->getVar('name')

3
ackbarr
Re: Display realname in template

If you turn on Smarty Debugging in System -> Preferences -> General Settings you will get a popup listing every smarty variable and their current value. The made available globally by the core are all prefixed with "xoops_"

4
ackbarr
Re: Display realname in template

In addition, this list in the XOOPS Development website will help you.

5
LazyBadger
Re: Display realname in template

Quote:

rider wrote:
Can someone tell me the code for displaying the Real Name of a user in a template?

Well, not pure code, but nice trick - another gift from Japan
If you'll add SIUN's (author of Simplified URL hack) Smarty-plugin, you will be able, using this plugin-modifier, get any user's profile info directly in template without additional PHP-code - you had to have only userid. Grab it here and use in form {$xoops_userid|suin_user:"name"} (for name, there are parameters for all other profile data)

6
tl
Re: Display realname in template
  • 2005/4/28 3:05

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


try this TIP
http://xoops-tips.com/news-article.storyid-19.htm

7
Mithrandir
Re: Display realname in template

Quote:

LazyBadger wrote:
Quote:

rider wrote:
Can someone tell me the code for displaying the Real Name of a user in a template?

Well, not pure code, but nice trick - another gift from Japan
If you'll add SIUN's (author of Simplified URL hack) Smarty-plugin, you will be able, using this plugin-modifier, get any user's profile info directly in template without additional PHP-code - you had to have only userid. Grab it here and use in form {$xoops_userid|suin_user:"name"} (for name, there are parameters for all other profile data)

Since I don't speak Japanese, I cannot give feedback directly, but will write it here.

Nice little modifier. I will suggest one small change, though, to keep the database queries to a minimum:

global $xoopsUser;
if (!
$xoopsUser) {
    
$member_handler =& xoops_gethandler('member');
    
$user =& $member_handler->getUser($userid);
}
else {
    
$user =& $xoopsUser;
}
if (
is_object($user)) {
    return 
$user->getVar($output);
}


instead of lines 110-117

That way there will not be a new lookup for each user variable if it is the currently logged in user - and the textsanitizer usage is not necessary here, as it is done in the call to getVar().

Thanks for pointing us to this nifty thing, Badger.

Login

Who's Online

175 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 175


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