1
phillipd
Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 17:13

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I would like an "admin" link, in my module, similar to the one in ms_weather that would allow users in a specific group to have admin rights to my module. I see how to allow admin rights to a module if you are webmaster but not if you are just a member of a group.

Also what does "$xoopsModule->mid()" do? I notice it is deprecated and as such there is no explanation of it. Where might I find what methods replace those that are deprecated?

Here is the ms_weather code snippet I'm working from. I need to check to see if the user is in a specific group to allow them to see the link to the admin page for this module.

// For Administrator only: Admin Menu
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
$isadmin = true;
} else {
$isadmin = false;
}
if ($isadmin) {
echo "
";
OpenTable();
echo "
"._MSW_ADM."
";
CloseTable();
} else {
echo "
";
}


Thanks

Doug P

2
Dave_L
Re: Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 17:37

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


getVar('mid') is the replacement for the deprecated method mid().

Here's the way to check if a user has admin rights to the current module:

$isadmin is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'));

3
phillipd
Re: Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 17:57

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Thanks, what is "mid"?

Doug P

4
Catzwolf
Re: Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 18:03

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Quote:

phillipd wrote:
Thanks, what is "mid"?

Doug P


Module ID

If you look at xoops_root/kernel/ you will find all the major class for xoops. Look for module


5
Dave_L
Re: Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 18:03

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Module ID

6
phillipd
Re: Would like a user to see an admin link if user is in a specific group
  • 2004/8/3 18:20

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Silly me... Ofcourse! Thanks...

Doug P

Login

Who's Online

417 user(s) are online (322 user(s) are browsing Support Forums)


Members: 0


Guests: 417


more...

Donat-O-Meter

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

Latest GitHub Commits