Not positve the core upgrade is what broke it but noticed it wasn't working shortly afterward.

On line 110 if ($zendesk_roles[$key] > 0) { this no longer works so I replaced it with

      if (isset($zendesk_roles[$key])) {

Seems to solve the issue and function as intended.

Comments

joseph.chambers’s picture

It was actually a little more complicated here is the new function I am using, it was checking on the key not the value of the user roles array, which only worked if your role id's were 1 2 3 but if you have deleted roles and the are more like 1 4 8 9 the the key isn't what you need. Hope this helps someone.

function zendesk_user_has_access($user) {
  $zendesk_roles = variable_get('zendesk_roles', array());
  if (!array_sum($zendesk_roles)) { // no roles are set, give access
    return TRUE;
  } 
  else {
   //removed because its not needed
    //$keys = array_keys($user->roles);
   //changed to use $key=>$value
    foreach ($user->roles as $key=>$value) {
      //if ($zendesk_roles[$key] > 0) {
      //changed from above if to work correctly
      if (isset($zendesk_roles[$value]) && $zendesk_roles[$value] > 0) {
      	return TRUE;
      }
    }
  }
  return FALSE;
}