07-14-2016, 01:29 PM
It sounds like you are wanting to use a negative logic. Here's how you need to think of this...
When you are on the admin dashboard, you see that there is a place at the top that says how many permission levels and you can manage them. When you click on manage them and click on administrator, you are taken to a page that shows you the id of that permission level. You're going to need that permission level id for your hiding feature.
Normally, we SHOW links if someone is a permission level. In the regular navigation.php we have this setup to show the admin dashboard only to admins.
//whatever you want to show
In your case, you want to figure out which permission level you want to NOT show, let's say it's an id of 3.
At the top of your navigation page in the custom php section, you need to write a query to check the db to see if your user is part of that particular permission group.
So, now for your menu...
menu link here
If that's not exactly it, it's really close. There might be a different way to do it, but I don't think the checkmenu helper function can be turned around in reverse.
When you are on the admin dashboard, you see that there is a place at the top that says how many permission levels and you can manage them. When you click on manage them and click on administrator, you are taken to a page that shows you the id of that permission level. You're going to need that permission level id for your hiding feature.
Normally, we SHOW links if someone is a permission level. In the regular navigation.php we have this setup to show the admin dashboard only to admins.
Code:
<?php if (checkMenu(2,$user->data()->id)){ //Links for permission level 2 (default admin) ?>
Code:
<?php } // is user an admin ?>
In your case, you want to figure out which permission level you want to NOT show, let's say it's an id of 3.
At the top of your navigation page in the custom php section, you need to write a query to check the db to see if your user is part of that particular permission group.
Code:
$id = $user->data()->id;
Code:
$permLev = 3; //the permission level you don't want to see the menu item.
Code:
$query = $db->query("SELECT * FROM user_permission_matches WHERE user_id = $id AND permission_id = $permLev");
Code:
$amIbanned = $query->count(); //If this count comes back as 1, that user is part of the group. If zero, then not.
So, now for your menu...
Code:
<?php if $amIbanned = 0 { ?>
Code:
<?php } ?>
If that's not exactly it, it's really close. There might be a different way to do it, but I don't think the checkmenu helper function can be turned around in reverse.