The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
![]() |
How to: make permissions remove toolbar links - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: How to: make permissions remove toolbar links (/showthread.php?tid=600) |
How to: make permissions remove toolbar links - bvnuser - 06-19-2017 In my toolbar I have a "Scripts" tab and an "Admin scripts" tab and I wanted to know how I can have the "Admin scripts" tab not show up if I'm logged in as a normal user. Thanks How to: make permissions remove toolbar links - firestorm - 06-19-2017 for logged in : <pre> Code: $user->isLoggedIn()){ also check if admin Code: if(checkMenu(2,$user->data()->id)) { your content } How to: make permissions remove toolbar links - mudmin - 06-20-2017 Also, if you want to only allow more than one permission level to see something (or not see something), there's the hasPerm function The venerable, old checkMenu function from the UserCake days was nice, but not really flexible as your number of permission levels grew. So, we have also added hasPerm. If you want something to show up (or not show up) or go through (or fail) based on a person’s permission level, you can now pass in an array. Code: if (hasPerm([2,103],$user->data()->id)){ Code: //do something Code: } You can pass in as many permission levels as you want into that [] array. Permission level ids can be found by going to the Admin dashboard and manage your permission levels. Click on one to get its id. Note that if you don’t make that first argument an array [] , it will throw an error, so use [] even if it is only for one permission level. |