Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » Real Name

#1 2008-02-16 11:47:29

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Real Name

I wasn’t sure where to put this so it’s here. In the txplib_head file $txp_user is called for the “logged in as” block. Is it possible to get the Realname as well?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#2 2008-02-16 12:27:47

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Real Name

Multiple ways.

One example:

get_author_name($txp_user);

Second example:

$user = array();
$user = safe_row('*','txp_users',"name = '". doSlash($txp_user)."'");
echo $user['RealName'];

Offline

#3 2008-02-16 12:38:46

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Real Name

Sorry Jukka. My PHP isn’t up to your standard. :)
Here’s the line I want to modify. It isn’t in the usual txplib_head file:-

$user_info = ($txp_user) ? gTxt('<span class="user">Welcome&nbsp;</span>').' '.tag($txp_user, 'span', ' class="user"').'<span class="logButton">'.tag(gTxt('logout'), 'a', ' href="?logout=1" class="logLink"'). '</span>' : '';

$txp_user is a “global”. How would I modify that?

Last edited by thebombsite (2008-02-16 12:39:11)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#4 2008-02-16 13:17:14

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Real Name

Basically it is like I said:

$user = array();
$user = safe_row('*','txp_users',"name = '". doSlash($txp_user)."'");
$user_info = ($txp_user) ? '<span class="user">Welcome&nbsp;</span><span class="user">'.$user['RealName'].'</span><span class="logButton"><a href="?logout=1" class="logLink">'.gTxt('logout').'</a></span>' : '';

PS. There isn’t language string named <span class="user">Welcome&nbsp;</span> ;D

Offline

#5 2008-02-16 15:40:00

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Real Name

Gocom wrote:

PS. There isn’t language string named <span class="user">Welcome&nbsp;</span> ;D

I know but I didn’t want to remove the gTxt because of things like brackets and periods and I didn’t want to break it. ;)

Thanks for the code anyway. :)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

  1. Index
  2. » How do I…?
  3. » Real Name

Board footer

Powered by FluxBB