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
DB-dynamic NavBar
#1
Hello,

I am trying to build a dynamic NavBar depending on the permission level of the logged in user.

My first approach was something like:


PHP Code:
$db DB::getInstance();
$permission $user->data()->permissions //(Source: https://userspice.com/documentation-user-class/)
if ($permission == "2") {      //  "2" means admin
 
 echo "<li><a href='overview.php'>Overview</a></li>";


But the problem is, that the list element doesn't even show up for the admin. When I echoed $permission it always showed "1" for all users I tried.
To me it looks like, that "$user->data()->permissions" outputs the permissions level of the user, that is necessary to access the current the page.
So when my page requires access level 1 and the admin has access levels 1 and 2,  "$user->data()->permissions" outputs 1.

Does anyone know a solution or am I just on the wrong path?

PS: I started using UserSpice about a week ago and want to thank developers very much for this great tool!
  Reply


Messages In This Thread
DB-dynamic NavBar - by zyan - 01-10-2019, 02:37 PM
RE: DB-dynamic NavBar - by mudmin - 01-10-2019, 02:40 PM
RE: DB-dynamic NavBar - by zyan - 01-10-2019, 02:56 PM
RE: DB-dynamic NavBar - by mudmin - 01-10-2019, 03:55 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)