Pages: [1]
Author Topic: Need help with custom userbar  (Read 1245 times)
Newbie
*

Karma: 0
Posts: 7


on: Oct 16, 08, 11:40 PM

I got my block all set but I cant seem to figure out how to make the username display...
I need the server side to call on the user name.
If someone could share the php code bit i would appreciate it.

For example, I need the server side code to make this work:
Code:
Welcome !USER_NAME_HERE!
*or*
<a href="!SITEROOT!/user/!USER_NAME_HERE!">


thanks. Grin
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #1 on: Oct 16, 08, 11:57 PM

on which pages that bar will be displayed? i.e. home, category, game, user, custom, any of those?
Logged
Newbie
*

Karma: 0
Posts: 7


Reply #2 on: Oct 17, 08, 12:21 AM

On pretty much every page.
I just got the username to work.
The code I was looking for was:
Code:
"!USER_NAME_HERE!" => $_SESSION['username']
but now my issue is how to change the options of the bar according to the users status.

example being:

Welcome Guest
VS
Welcome User


I need the code to do this:
Code:
If :
User logged in
Display:
Block_1.html

If:
User logged out
Display:
Block_2.html
If that makes any sense to you...
« Last Edit: Oct 17, 08, 12:57 AM by ReaperX » Logged
Newbie
*

Karma: 0
Posts: 7


Reply #3 on: Oct 17, 08, 12:50 AM

Ok, figured that out too. haha
This seems to work fine:
Code:


//This works like a charm

if ( isset($_SESSION["user"]) && !empty($_SESSION["user"]) )
{
$tpl->define( "tplUserbar", "block_userbar.html" );
}
else
{
$tpl->define( "tplUserbar", "block_userbar2.html" );
}
$tpl->parse( "USERBAR", "tplUserbar" );

Hope this helps anyone who wants to do some custom stuff.
« Last Edit: Oct 17, 08, 12:54 AM by ReaperX » Logged
Pages: [1]
 
Jump to: