06-20-2017, 11:38 AM
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.
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.
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.