You are here

function subscriptions_content_comment_load in Subscriptions 5.2

Same name and namespace in other branches
  1. 6 subscriptions_content.module \subscriptions_content_comment_load()

Custom function for loading comments.

Function name stored in {subscriptions_queue}.load_func and called by subscriptions_mail().

Parameters

$cid: Comment ID.

$sqid: Subscriptions queue ID.

Return value

node as array().

4 string references to 'subscriptions_content_comment_load'
subscriptions_content_comment in ./subscriptions_content.module
Implementation of hook_comment().
_subscriptions_content_access in ./subscriptions_content.module
Implementation of hook_access(), subhook of hook_subscriptions().
_subscriptions_content_load in ./subscriptions_content.module
Returns a node if published, including any comments that are still queued, but limited by the given subscriptions queue ID.
_subscriptions_content_node_mailvars in ./subscriptions_content.module
Fill given array of mailvars with given node values.

File

./subscriptions_content.module, line 809
Subscriptions to content events

Code

function subscriptions_content_comment_load($cid, $sqid) {
  $nid = db_result(db_query('SELECT nid FROM {comments} WHERE cid = %d', $cid));
  if (empty($nid)) {
    return;
  }
  $item = db_fetch_array(db_query('SELECT * FROM {subscriptions_queue} WHERE sqid = %d', $sqid));
  if ($item['module'] != 'node' || $item['field'] != 'nid') {

    // Only if we're processing a node/nid queue item should we cut off the comments at an update item, otherwise not:
    $sqid = NULL;
  }
  $node = _subscriptions_content_load($nid, $sqid);
  if (empty($node->_subscriptions_comments)) {
    return;
  }
  return $node;
}