public function FeedsCommentProcessor::entitySave in Feeds Comment Processor 7
File
- ./
FeedsCommentProcessor.inc, line 105 - Contains FeedsCommentProcessor.
Class
- FeedsCommentProcessor
- Creates comments from feed items.
Code
public function entitySave($comment) {
// Mapping an existing cid that does't exist in the database. Force it.
if (!empty($comment->feeds_is_new) && $comment->cid) {
if (empty($comment->thread)) {
$comment->thread = $this
->calculateThread($comment);
}
drupal_write_record('comment', $comment);
}
// Trick ip_address() to return the ip address mapped to the comment.
$prev_ip = ip_address();
$ip_address =& drupal_static('ip_address');
// Set the ip address to the comment hostname.
$ip_address = $comment->hostname;
comment_save($comment);
// Restore the previous ip.
$ip_address = $prev_ip;
}