Follow-up to #2554965: hook_comment_unpublish is never invoked

Problem/Motivation

hook_comment_publish is called every time the published comment is saved.

Proposed resolution

It should be called only when the status of the comment is changed from unpublished to published.

Remaining tasks

Reviews

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

AjitS created an issue. See original summary.

ajits’s picture

Title: hook_comment publish to be called » hook_comment publish to be called only on the status change and not every time
ajits’s picture

Status: Active » Needs review
StatusFileSize
new1.12 KB
ajits’s picture

Status: Needs review » Needs work

The last submitted patch, 3: hook_comment_publish_to-2558629-3.patch, failed testing.

sumitmadan’s picture

Status: Needs work » Needs review
StatusFileSize
new703 bytes
new1.26 KB

Re-rolled the patch. Please do a review.

Status: Needs review » Needs work

The last submitted patch, 6: hook_comment_publish_to-2558629-6.patch, failed testing.

sumitmadan’s picture

Status: Needs work » Needs review
sumitmadan’s picture

rashid_786’s picture

StatusFileSize
new705 bytes
new720 bytes

Comment line should above the module_invoke_all('comment_publish', $comment);

poker10’s picture

Status: Needs review » Postponed
poker10’s picture

Status: Postponed » Closed (won't fix)

The #2554965: hook_comment_unpublish is never invoked is committed. I am going to close this as Won't fix, because it seems to be a big change for this D7 phase. The second reason is that there is a comfort "workaround", as the $comment object in hook_comment_publish()/hook_comment_unpublish contains also the original comment ($comment->original). Therefore any modules relying on this functionality are able to check what status transition it was and take appropriate actions only when needed. Because of this I do not see any particular strong reasons doing such change.

Let's fix only documentation in #1777166: hook_comment_publish() docs are completely wrong. Thanks!