function _zopim_visibility_roles in Zopim Live Chat 7
Same name and namespace in other branches
- 6.2 zopim.module \_zopim_visibility_roles()
- 6 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.
Parameters
object $account: a full user object.
Return value
boolean a decision on visibility, true/false
1 call to _zopim_visibility_roles()
- _zopim_visibility_user_test in ./
zopim.module - Utility function to perform tracking visibility check for an user object.
File
- ./
zopim.module, line 178
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;
}