You are here

function _support_enabled in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support.module \_support_enabled()
1 call to _support_enabled()
_support_subscribe_form_attach in ./support.module
Provide option to subscribe/unsubscribe from ticket notification emails.

File

./support.module, line 3879
support.module

Code

function _support_enabled($clid, $uid) {
  static $enabled = array();
  if (!isset($enabled[$clid])) {
    $autosubscribe = db_query('SELECT autosubscribe FROM {support_client} WHERE clid = :clid', array(
      ':clid' => $clid,
    ))
      ->fetchField();
    $names = explode(',', $autosubscribe);
    foreach ($names as $name) {
      $accounts = user_load_multiple(array(), array(
        'name' => trim($name),
      ));
      $account = array_shift($accounts);
      $enabled[$clid][$account->uid] = TRUE;
    }
  }
  return isset($enabled[$clid][$uid]);
}