05-11-2017, 04:59 PM
Oh dear! Spoke too soon. If I now use this function (hasPerm) to validate if an unauthorised user role has access, I get a fatal PHP error within users/us_helpers.php. This seems to relate to a variable around line 788 which references an undefined variable "$master_account".
The original code was
Two issues - neither $user nor $master_account appear to be defined within the function's scope. I fixed the $user variable by using the $id parameter passed into the function.
I'm not sure how to define $master_account though. It should be an array, but I wasn't sure whether it should be populated by the earlier foreach loop? Or maybe just the array passed into the function?
The original code was
Code:
if (in_array($user->data()->id, $master_account)){
Two issues - neither $user nor $master_account appear to be defined within the function's scope. I fixed the $user variable by using the $id parameter passed into the function.
I'm not sure how to define $master_account though. It should be an array, but I wasn't sure whether it should be populated by the earlier foreach loop? Or maybe just the array passed into the function?