The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if user is admin
#3
Note that hasPerm is made to be an array so it can do multiple levels at once, so it's expecting an array.

When you go into the admin panel and click admin permissions and then click a permission, if you look at this screenshot
http://puu.sh/xx701/7a52b51a58.png

You'll see that each permission has an id on it. By default, Admin is 2. If you add others like staff and manager, they'll come in at 3 & 4. Then you have to pass the user id into either checkMenu or hasPerm.

With that array, let's say you want permission levels 2 and 4 to be able to do something, that would be

Code:
if(hasPerm([2,4],$user->data()->id)){
Code:
//do something
Code:
}
  Reply


Messages In This Thread
Check if user is admin - by Brandin - 09-11-2017, 09:11 AM
Check if user is admin - by mudmin - 09-11-2017, 11:54 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)