No module exists for merging double posts/comments in D6... is there a possibility of a backport to D6?

Comments

RazvanRanca’s picture

Status: Active » Closed (won't fix)

I initially wanted to make this for drupal 6, but i couldn't figure out a good way of doing it(as in without changing the database by myself which might screw up other modules).

Drupal 7 introduced this http://api.drupal.org/api/function/hook_comment_presave/7 hook, which i use. Drupal 6 doesn't have a presave action in http://api.drupal.org/api/function/hook_comment/6 .

However, if anybody has any ideas on how it may be done in drupal 6, please let me know and I'll look into it.

Until then I'm marking this as won't fix.

RazvanRanca’s picture

Version: 7.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » RazvanRanca
Status: Closed (won't fix) » Needs work

Hmm, i kept thinking about this and maybe it's possible after all, I'm not sure.

I added the basic functionality in a 6.x dev version, but right now it's doing the hack the database thing i mentioned above. I'm thinking if i can programatically simulate a comment edit and delete and invoke all other interested modules in the process this might work.

I'm going to try to figure this out.

cor3huis’s picture

Make sure you use D6.20 or higher, the code is in flux. It is best to take a look in comment.module since API documentation is sometimes incorrect.

You options possibly:
- comment_nodeapi with using $OP in a switch
- comment_presave($edit)

Investigating presave for comment changed and created myself...

RazvanRanca’s picture

Status: Needs work » Closed (won't fix)

I've looked into this again, but I can't seem to find a way to do it better.

hook_nodeapi doesn't work because the presave hook is only called when nodes are created, not comments.
A comment presave hook doesn't seem to exist in drupal 6
And though it's possible to modify a comment at the validation stage, the modifications don't seem to carry through, the comment being written in the database in it's original form.

Since I can't find a way to improve on this implementation I'll have to close these backport issues.