function _zopim_visibility_roles in Zopim Live Chat 6
Same name and namespace in other branches
- 6.2 zopim.module \_zopim_visibility_roles()
- 7 zopim.module \_zopim_visibility_roles()
Based on visibility setting this function returns TRUE if Zopim code should be added for the current role and otherwise FALSE.
1 call to _zopim_visibility_roles()
- _zopim_visibility_user in ./
zopim.module - Tracking visibility check for an user object.
File
- ./
zopim.module, line 133
Code
function _zopim_visibility_roles($account) {
$enabled = TRUE;
$roles = variable_get('zopim_roles', array());
if (array_sum($roles) > 0) {
// One or more roles are selected for tracking.
foreach (array_keys($account->roles) as $rid) {
// Is the current user a member of one role selected in admin settings?
if (isset($roles[$rid]) && $rid == $roles[$rid]) {
// Current user is a member of a role that is selected in admin settings.
$enabled = FALSE;
break;
}
}
}
return $enabled;
}