1
CONFIQ
$is_admin in PHP?
  • 2006/6/3 13:28

  • CONFIQ

  • Just popping in

  • Posts: 21

  • Since: 2006/4/21


Hello all!
I know that i can check whatever user is admin/registered by smarty (ex: $xoops_isadmin/$xoops_isuser) but how do i check it with simple PHP?

$xoopsUser class gets those informations but if i write
$xoopsUser->getVar('uid'),
i get error that xoopsUser class is not loeaded! (if i'm not identified)

How do i check if user is registered or not?

2
Jan304
Re: $is_admin in PHP?
  • 2006/6/3 14:37

  • Jan304

  • Official Support Member

  • Posts: 520

  • Since: 2002/3/31


The lame method:

if ($xoopsUser != '') {
    
$uid $xoopsUser->getVar('uid');
}else{
    
$uid 0;
}
Oracle: I'd ask you to sit down, but, you're not going to anyway. And don't worry about the vase.
Neo: What vase?
[Neo turns to look for a vase, and as he does, he knocks over a vase of flowers, which shatters on the floor.]
Oracle: That vase.
Neo:...

3
Dave_L
Re: $is_admin in PHP?
  • 2006/6/3 15:08

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Depending on the context, you might need:

global $xoopsUser;

4
m0nty
Re: $is_admin in PHP?
  • 2006/6/3 15:18

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


a better method would be:

if (is_object($xoopsUser)) {
    
$uid $xoopsUser->getVar('uid');
}else{
    
$uid 0;
}


but make sure $xoopsUser is defined as dave mentions above.

5
CONFIQ
Re: $is_admin in PHP?
  • 2006/6/3 16:03

  • CONFIQ

  • Just popping in

  • Posts: 21

  • Since: 2006/4/21


I'll check it out... thank you for your help!

Login

Who's Online

153 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 153


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