08-31-2017, 05:57 AM
Hi!
I'm having some problems with the hasPerm function. In a part of a page (dashboard.php), I want to show a menu only to users with permission id=2. So, I write:
<pre></pre>
Everything works fine if user "admin" is logged in ("admin" has permission of "Administrator" (id=2) and "User" (id=1)). But when user "dummy" (who has permision of "User" (id=1) only) I get this error:
Notice: Undefined variable: master_account in C:\wamp\www\true\admin\production\users\helpers\us_helpers.php on line 788
Call Stack
# Time Memory Function Location
1 0.0008 259656 {main}( ) ..\dashboard.php:0
2 0.0546 1098544 hasPerm( ) ..\dashboard.php:50
( ! ) Warning: in_array() expects parameter 2 to be array, null given in C:\wamp\www\true\admin\production\users\helpers\us_helpers.php on line 788
Call Stack
# Time Memory Function Location
1 0.0008 259656 {main}( ) ..\dashboard.php:0
2 0.0546 1098544 hasPerm( ) ..\dashboard.php:50
3 0.0821 1100296 in_array ( ) ..\us_helpers.php:788
Can anyone give some help, please? I can't understand what's happening here. Thank you!
I'm having some problems with the hasPerm function. In a part of a page (dashboard.php), I want to show a menu only to users with permission id=2. So, I write:
<pre>
Code:
if(hasPerm([2],$user->data()->id)){
// Some stuff
}
Everything works fine if user "admin" is logged in ("admin" has permission of "Administrator" (id=2) and "User" (id=1)). But when user "dummy" (who has permision of "User" (id=1) only) I get this error:
Notice: Undefined variable: master_account in C:\wamp\www\true\admin\production\users\helpers\us_helpers.php on line 788
Call Stack
# Time Memory Function Location
1 0.0008 259656 {main}( ) ..\dashboard.php:0
2 0.0546 1098544 hasPerm( ) ..\dashboard.php:50
( ! ) Warning: in_array() expects parameter 2 to be array, null given in C:\wamp\www\true\admin\production\users\helpers\us_helpers.php on line 788
Call Stack
# Time Memory Function Location
1 0.0008 259656 {main}( ) ..\dashboard.php:0
2 0.0546 1098544 hasPerm( ) ..\dashboard.php:50
3 0.0821 1100296 in_array ( ) ..\us_helpers.php:788
Can anyone give some help, please? I can't understand what's happening here. Thank you!