function subscriptions_taxonomy_subscriptions in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions_taxonomy.module \subscriptions_taxonomy_subscriptions()
- 7 subscriptions_taxonomy.module \subscriptions_taxonomy_subscriptions()
- 2.0.x subscriptions_taxonomy/subscriptions_taxonomy.module \subscriptions_taxonomy_subscriptions()
Implementation of hook_subscriptions().
File
- ./
subscriptions_taxonomy.module, line 19 - Subscriptions to taxonomy terms.
Code
function subscriptions_taxonomy_subscriptions($op, $arg0 = NULL, $arg1 = NULL, $arg2 = NULL) {
static $stypes = array(
'taxa' => array(
'node',
'tid',
),
);
$function = '_subscriptions_taxonomy_' . $op;
if (function_exists($function)) {
return $function($arg0, $arg1, $arg2);
}
switch ($op) {
case 'queue':
// $arg0 is $event array.
if ($arg0['module'] == 'node') {
$node = $arg0['node'];
$params['node']['tid'] = array(
'join' => 'INNER JOIN {term_node} tn ON s.value = ' . ($GLOBALS['db_type'] == 'pgsql' ? 'CAST(' : '') . 'tn.tid' . ($GLOBALS['db_type'] == 'pgsql' ? ' AS VARCHAR)' : ''),
'where' => 'tn.nid = %d',
'args' => array(
$node->nid,
),
'groupby' => 'GROUP BY u.uid, tn.nid' . ($GLOBALS['db_type'] != 'pgsql' ? '' : ', s.module, s.field, s.value, s.author_uid, s.send_interval, su.digest, last_sent, su.suspended'),
);
if ($arg0['type'] == 'comment') {
$where = ' AND s.send_comments = 1';
}
elseif ($arg0['type'] == 'node' && $arg0['action'] == 'update') {
$where = ' AND s.send_updates = 1';
}
if (isset($where)) {
$params['node']['tid']['where'] .= $where;
}
return $params;
}
break;
case 'fields':
// Parameter is module
if ($arg0 == 'node' || $arg0 == 'comment') {
$tr = 't';
return array(
'tid' => array(
'mailvars_function' => '_subscriptions_content_node_mailvars',
'mailkey' => 'subscriptions_taxonomy_node-tid',
'!subs_type' => $tr('category'),
),
);
}
break;
case 'stypes':
return $stypes;
case 'stype':
return isset($stypes[$arg0]) ? array_merge($stypes[$arg0], array(
$arg1,
$arg2,
)) : NULL;
}
}