You are here

function olark_init in Olark Chat 6

Implements hook_init().

File

./olark.module, line 84
Integrates Olark Chat in a Drupal site.

Code

function olark_init() {

  // Note that the 'olark_enable' variable can be (un)set in
  // the $conf array in settings.php, or by another module to enable/disable
  // however, there is not a user interface for this variable.
  $role_display_olark_chat = olark_check_role_access();

  //if the display olark chat AND the variable for olark enable is true, then display Olark Chat
  if ($role_display_olark_chat && variable_get('olark_enable', 1)) {
    if (!variable_get('olark_context', 0)) {
      olark_add_js();
    }
    else {
      if ($plugin = context_get_plugin('reaction', 'olark_add')) {
        if ($plugin
          ->execute()) {
          olark_add_js();
        }
      }
    }
  }
}