The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
GetRoles - 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: GetRoles (/showthread.php?tid=934) Pages:
1
2
|
GetRoles - shoropio - 02-06-2018 Hi guys, @mudmin made this function for me, Code: <?php getRoles(1);?> <pre> Code: function getRoles($id, $opts = []){ it's about calling the role the user has on the site. For example, I am the administrator and the user and administrator come out under the photo. but if I enter as a user the same thing comes out, what it means is that that function calls all the permissions not precisely to the specific permission. There will be a way to call the right permit. GetRoles - mudmin - 02-06-2018 I can test it again. Are you saying that it is showing every role for every user? GetRoles - shoropio - 02-06-2018 Exactly, that the user shows that the role in the site is the user and the administrator administrator and moderator moderator etc. GetRoles - mudmin - 02-06-2018 It works fine for me. I'm guessing you're not passing in the user id. If you pass in Code: getRoles(1); What happens if you do Code: $u = $db->query("SELECT id FROM users")->results(); Code: foreach($u as $v){ Code: echouser($v->id); Code: echo "-"; Code: getRoles($v->id); Code: echo "<br>"; Code: } GetRoles - mudmin - 02-06-2018 So do you only want it to show 1 role per user? GetRoles - shoropio - 02-06-2018 Yes, the corresponding one. GetRoles - shoropio - 02-06-2018 Example, if you register on my site you would have user permissions. under the profile picture your name would appear and below this user as a role. GetRoles - shoropio - 02-06-2018 GetRoles - mudmin - 02-06-2018 Ok. So you have to do some logic. How many user roles do you have and what are they? GetRoles - shoropio - 02-06-2018 Only the ordinary, user and administrator. |