function zopim_init in Zopim Live Chat 6.2
File
- ./
zopim.module, line 84
Code
function zopim_init() {
global $user;
$settings = zopim_get_settings();
if (!empty($settings['general']['account_key']) && $settings['visibility']['enabled'] && _zopim_visibility_pages() && _zopim_visibility_user($user)) {
$domain = ZOPIM_SCRIPT_DOMAIN;
if (!empty($settings['general']['salt']) && $settings['general']['account'] === 1 && $settings['visibility']['enabled'] === 1) {
$js_settings = $settings;
unset($js_settings['general']['username'], $js_settings['general']['password']);
// If user is logged in then setup his info in the settings array.
if (!user_is_anonymous() && $settings['widget']['use_user_info'] === 1) {
if ($user->name != '') {
$js_settings['user']['name'] = $user->name;
}
if ($user->mail != '') {
$js_settings['user']['email'] = $user->mail;
}
}
drupal_add_js(array(
'zopim' => $js_settings,
), 'setting');
}
}
}