Admin area: “PHP Notice: Undefined offset: 0”
-
Hello,
When a user (no admin) go to admin area, there are multiple error messages:
PHP Notice: Undefined offset: 0 in [...]/plugins/security-malware-firewall/inc/spbc-admin.php on line 471
Can you fix it?
Here is the code:
$roles = (is_array($user->roles) && !empty($user->roles) ? $user->roles[0] : null); // Takes only first role.
And a fix:
$roles = (is_array($user->roles) && !empty($user->roles) ? reset($user->roles) : null); // Takes only first role.
The user has contributor role.
Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Admin area: “PHP Notice: Undefined offset: 0”’ is closed to new replies.