If you assign roles to track the code fails.

Line 366: $roles_to_track is set to :

Array
(
[1] => 1
[2] => 2
)

[e.g., if you select anon & auth users]

However, $user->roles has the actual name of the role, not the id.

Proposed fix:

  foreach ($user->roles as $rid => $role) {
    if (in_array($rid, $roles_to_track)) {
      return TRUE;
    }
  }

Add in the $rid and check that since it has the numeric id and not the text value.

Comments

sikjoy’s picture

Status: Needs review » Fixed

Fantastic bit of bug squashing!

Thanks m3avrck!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.