You are here

function _support_autosubscribe in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support.module \_support_autosubscribe()

Autosubscribe users to new client ticket.

3 calls to _support_autosubscribe()
support_comment in ./support.module
Implementation of hook_comment().
support_nodeapi in ./support.module
Implementation of hook_nodeapi().
support_subscribe_form in ./support.module
Provide option to subscribe/unsubscribe from ticket notification emails.

File

./support.module, line 1653
support.module

Code

function _support_autosubscribe($nid, $client, $save = TRUE) {
  $accounts = array();
  $autosubscribe = db_result(db_query('SELECT autosubscribe FROM {support_client} WHERE clid = %d', $client));
  $autosubscribe = explode(',', $autosubscribe);
  foreach ($autosubscribe as $name) {
    $account = user_load(array(
      'name' => trim($name),
    ));
    if (is_object($account) && $account->uid) {
      $accounts[$account->uid] = $account->uid;
      if ($save) {
        support_subscribe_user($nid, $account->uid);
      }
    }
  }
  return $accounts;
}