You are here

function _subscriptions_content_format_comments in Subscriptions 5.2

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

Given a comment template returns a formatted text of comments for given node.

2 calls to _subscriptions_content_format_comments()
subscriptions_mail_cron in ./subscriptions_mail.module
Implementation of hook_cron().
_subscriptions_content_node_mailvars in ./subscriptions_content.module
Fill given array of mailvars with given node values.

File

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

Code

function _subscriptions_content_format_comments($node, $comment_template, $separator) {
  $comments = array();
  foreach ($node->_subscriptions_comments as $comment) {
    $mailvars = array(
      '!comment_name' => $comment->uid == 0 ? variable_get('anonymous', '!comment_name') : $comment->name,
      '!comment_title' => trim($comment->subject),
      '!comment_text' => _subscriptions_content_format_text($comment->comment, $comment->format),
      '!comment_url' => url('node/' . $comment->nid, NULL, 'comment-' . $comment->cid, TRUE),
      '!comment_is_new' => (int) $comment->_subscriptions_is_new,
      '!comment_is_published' => (int) ($comment->status == COMMENT_PUBLISHED),
    );
    $template = module_invoke('subscriptions_mail', 'template_preprocess', $comment_template, $mailvars);
    $comments[] = strtr($template ? $template : $comment_template, $mailvars);
  }
  return implode($separator, $comments);
}