1
DonXoop
Efficient Group check in a module?

A side effect of 2.0.7.1 is that Shoutbox now correctly only shows the Clear button for Admins.

Can I replace the isAdmin() check with a group check? It needs to be as efficient as isAdmin. If I can check for one group those members will then see the Clear button for example.


2
Mithrandir
Re: Efficient Group check in a module?

$groups $xoopsUser $xoopsUser->getGroups : array(XOOPS_GROUP_ANONYMOUS);
if (
in_array($desired_group$groups)) {
    
//User is in desired group
}

$xoopsUser->getGroups runs without database calls as the user's groups are saved in a Session variable. $desired_group can be either a hard-coded value or you can add it to the block options.

3
DonXoop
Re: Efficient Group check in a module?

Ah thanks, I think that is exactly what I'm looking for. I can lookup the groupid in the db and use that with this function.

Thanks again!

Login

Who's Online

450 user(s) are online (60 user(s) are browsing Support Forums)


Members: 0


Guests: 450


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