1
marcuschan
show user name in my own block
  • 2004/11/5 11:24

  • marcuschan

  • Just popping in

  • Posts: 5

  • Since: 2004/11/5


Hi,

I just installed xoops2.0.7.3 and created a new block.

I have added some HTML lines in the block, That worked fine.

I then added php lines in the block (i.e. phpinfo()), that also worked fine.

Now I want to show the "username" but have no idea how to get the user info. I tried

$username = $xoopsUser->getVar('uname');

but got "$xoopsUser is not an object".

Please tell me how to get $xoopsUser.

Thanks!!

Regards,
Marcus

2
Dave_L
Re: show user name in my own block
  • 2004/11/5 12:07

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


global $xoopsUser;
$uname is_object($xoopsUser) ? $xoopsUser->getVar('uname') : '(guest)';
echo 
$uname;

3
marcuschan
Re: show user name in my own block
  • 2004/11/5 12:36

  • marcuschan

  • Just popping in

  • Posts: 5

  • Since: 2004/11/5


Hi Dave,

I got '(guest)' using your method!

more info of what I have done:
1. I add in the new block I created.
2. I added your method in the xx.php.
3. $xoopsUser is not yet set. (so I got (guest))

I believe I need to add something like "include mainfile.php; " to setup the system objects before I may use $xoopsUser, right?

Please give me more details. I am a newbie!

Thanks, Macus

4
marcuschan
Re: show user name in my own block
  • 2004/11/5 16:34

  • marcuschan

  • Just popping in

  • Posts: 5

  • Since: 2004/11/5


Hi all;

After I added "include mainfile;", I can use $xoopsUser now.

Thanks.

Marcus.

Login

Who's Online

360 user(s) are online (53 user(s) are browsing Support Forums)


Members: 0


Guests: 360


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits