You are here

protected function FeedsCommentProcessor::buildComment in Feeds Comment Processor 6

Creates a new comment object in memory and returns it.

1 call to FeedsCommentProcessor::buildComment()
FeedsCommentProcessor::process in ./FeedsCommentProcessor.inc
Implementation of FeedsProcessor::process().

File

./FeedsCommentProcessor.inc, line 330
Class definition of FeedsCommentProcessor.

Class

FeedsCommentProcessor
Creates comments from feed items.

Code

protected function buildComment($cid, $feed_nid) {
  $comment = new stdClass();
  if (empty($cid)) {
    $comment->created = FEEDS_REQUEST_TIME;
    $populate = TRUE;
  }
  else {
    if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
      $comment = _comment_load($cid);
    }
    else {
      $comment->cid = $cid;
      $populate = TRUE;
    }
  }
  if ($populate) {
    $comment->timestamp = FEEDS_REQUEST_TIME;
    $comment->format = $this->config['input_format'];
    $comment->feeds_comment_item = new stdClass();
    $comment->feeds_comment_item->id = $this->id;
    $comment->feeds_comment_item->imported = FEEDS_REQUEST_TIME;
    $comment->feeds_comment_item->feed_nid = $feed_nid;
    $comment->feeds_comment_item->guid = '';
    $comment->uid = $this->config['author'];
    $account = user_load(array(
      'uid' => $comment->uid,
    ));
    $comment->name = $account->name;
    $comment->mail = $account->mail;
    $comment->status = 0;
    $comment->pid = 0;
    $comment->hostname = '127.0.0.1';
  }
  return $comment;
}