The issue is that I'm trying to import comments into drupal by creating the object array and using comment_save($comment). I'm backdating the comments I'm importing using $comment['timestamp'] but this gets overridden if the comment doesn't have a comment id, which it of course doesn't because it's a new comment.

Suggest that the timestamp is only set to 'now' iff someone hasn't manually changed it.

Here's the patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

seems reasonable as long as the comment form cannot be tricked, which is unlikely but should be verified.

drumm’s picture

Version: 5.2 » 6.x-dev
Status: Needs review » Needs work

This might be an API change. I think it should go into Drupal 6.x before being considered for 5.x.

My only code change would be the comment. It should be an English sentence with capitalization and punctuation. And it is useful for purposes other than importing. Maybe "Default to the current time if a timestamp is not present."

catch’s picture

partially related to this: http://drupal.org/node/55277

Possibly there should be an "updated" column in comments for drupal 7?

nterbogt’s picture

Here's a new patch. It's against 5.2 though because I haven't checked out 6.x.

nterbogt’s picture

Status: Needs work » Needs review

Changing this back to needing review.

bdragon’s picture

Here's a 6.x version.

Pasqualle’s picture

Version: 6.x-dev » 7.x-dev
nevergone’s picture

Status: Needs review » Reviewed & tested by the community

Correct patch.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

1. Patch no longer applies.

2. It would be great if we could write a test case for this.

Pasqualle’s picture

Status: Needs work » Closed (duplicate)

sorry, this is already fixed in D7
#253577: Allow new comment timestamp to be passed