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
how to hide link
#2
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.

Code:
<?php if (checkMenu(2,$user->data()->id)){  //Links for permission level 2 (default admin) ?>
//whatever you want to show
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 { ?>
menu link here
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.


  Reply


Messages In This Thread
how to hide link - by ejaw - 07-14-2016, 12:47 PM
how to hide link - by mudmin - 07-14-2016, 01:29 PM
how to hide link - by ejaw - 07-15-2016, 10:57 AM
how to hide link - by picassoo - 10-05-2016, 04:18 AM
how to hide link - by ejaw - 11-02-2016, 01:51 PM
how to hide link - by dan - 11-07-2016, 12:39 AM
how to hide link - by sire - 03-14-2017, 10:13 PM
how to hide link - by mudmin - 03-15-2017, 04:22 AM
how to hide link - by sire - 03-19-2017, 05:37 AM
how to hide link - by JUG - 03-19-2017, 07:20 AM
how to hide link - by JUG - 03-19-2017, 07:30 AM
how to hide link - by sire - 03-19-2017, 08:14 AM
how to hide link - by JUG - 03-19-2017, 08:38 AM
how to hide link - by sire - 03-19-2017, 08:43 AM
how to hide link - by sire - 03-19-2017, 08:46 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)