1
Coplan
Check for Module Admin
  • 2003/10/23 17:21

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


This is a very simple question. I'm writing a module for XOOPS 2.0.x, and I want to start working on the administrative side of things. I want certain links (like edit entry) to appear only if the person has admin rights for that module.

How do I test if a person has admin rights for a given module? I know it's probably a simple class or function that's already defined somewhere.

(I believe this has nothing to do with the module permissions post that was at the top of this forum. I read that, and I don't see that as the same thing)

Thanks,

2
ackbarr
Re: Check for Module Admin

//Get the current module's ID #
$mid $xoopsModule->mid();

//See if the current user is an admin
if ($xoopsUser->isAdmin($mid)) {
  
// User is admin
} else {
  
// User is not admin
}


Please note that $xoopsUser is only filled when a user has logged in. So check that $xoopsUser is filled first prior to this check.

3
Coplan
Re: Check for Module Admin
  • 2003/10/24 15:08

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


Does the isAdmin() function check the xoops_version script so that it knows what module its in? IN other words, does it automatically know that since its in Script X that it must be a part of module X?

4
ackbarr
Re: Check for Module Admin

no that's why you need to specify the module ID you want to check permissions in (see the above code, lines 1-3)

Login

Who's Online

136 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 136


more...

Donat-O-Meter

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

Latest GitHub Commits