Page Index Toggle Pages: 1
Topic Tools
Normal Topic Access Yabb Username in Template (Read 2,153 times)
SteveInTN
YaBB Newcomer
*
Offline



Posts: 19
Access Yabb Username in Template
Jun 1st, 2010 at 5:24pm
Post Tools
Hello, is there a way that I can access the Yabb username in the template?  I'm thinking it is something along the lines of:

{yabb username}

But I cannot find the right combo.  Any help would be appreciated.  I'm sure this is a simple one for everyone here.  I've searched for about 30 minutes and cannot find it.

Thanks,

Steve
  
Back to top
 
IP Logged
 
SteveInTN
YaBB Newcomer
*
Offline



Posts: 19
Re: Access Yabb Username in Template
Reply #1 - Jun 1st, 2010 at 5:32pm
Post Tools
{yabb uname}

Gives me more than just the username
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Access Yabb Username in Template
Reply #2 - Jun 1st, 2010 at 5:57pm
Post Tools
Hi,

I don't believe a tag exists just for the name, so you'd have to make a simple code edit...

Find this line in Sources/Subs.pl

Code
Select All
    $yydefaultimages = $defaultimagesdir; 


And add after:

Code
Select All
    $yyname = ${$uid.$username}{'realname'}; 


You'll then be able to use {yabb name}
  
Back to top
 
IP Logged
 
Captain John
Ex Member


Re: Access Yabb Username in Template
Reply #3 - Jun 1st, 2010 at 6:28pm
Post Tools
Are you sure you want to expose (display) the username ?  The display name is used in memberlist and posts.  Some users repeatedly use the same name (user name) to login to other sites, could reduce their security.
  
Back to top
 
IP Logged
 
SteveInTN
YaBB Newcomer
*
Offline



Posts: 19
Re: Access Yabb Username in Template
Reply #4 - Jun 1st, 2010 at 6:42pm
Post Tools
Thank you VERY MUCH Derek!
  
Back to top
 
IP Logged
 
SteveInTN
YaBB Newcomer
*
Offline



Posts: 19
Re: Access Yabb Username in Template
Reply #5 - Jun 1st, 2010 at 6:45pm
Post Tools
Capt John,  I wanted to access it so I could pass it off to a widget I developed.
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Access Yabb Username in Template
Reply #6 - Jun 1st, 2010 at 6:59pm
Post Tools
You're welcome.

The code I posted up though does use the display name and not the username - If you wanted the username instead let me know...

You might also want to change it to this, so if a user isn't logged in, it will use 'Guest' as their name, otherwise nothing will display...

Code
Select All
    if ($iamguest) {
        $yyname = "$maintxt{'28'}";
    } else {
	$yyname = "${$uid.$username}{'realname'}";
    } 


CJ - The username wouldn't be visible to anyone but the user anyway...
« Last Edit: Jun 1st, 2010 at 7:05pm by Derek Barnstorm »  
Back to top
 
IP Logged
 
SteveInTN
YaBB Newcomer
*
Offline



Posts: 19
Re: Access Yabb Username in Template
Reply #7 - Jun 1st, 2010 at 7:06pm
Post Tools
Derek,  that is precisely what I wanted.  If user isn't logged in then no value and my widget restricts what they can do.  Thanks again!
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Access Yabb Username in Template
Reply #8 - Jun 1st, 2010 at 7:10pm
Post Tools
Okay, cool. No problem.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top