You are here

function _zopim_role in Zopim Live Chat 8

Check if Zopim Chat widget should be active for the current user role.

Return value

boolean TRUE if it should be active for the current user, otherwise FALSE.

1 call to _zopim_role()
zopim_page_attachments in ./zopim.module
Implements hook_page_attachments().

File

./zopim.module, line 99

Code

function _zopim_role() {
  $current_user_roles = Drupal::currentUser()
    ->getRoles();
  $selected_roles = \Drupal::config('zopim.settings')
    ->get('roles');
  if (count($selected_roles) == 0 || !array_intersect($current_user_roles, $selected_roles)) {
    return TRUE;
  }
  return FALSE;
}