Closed (won't fix)
Project:
Workflow-ng
Version:
5.x-2.0
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 May 2008 at 18:35 UTC
Updated:
7 May 2008 at 11:44 UTC
There was no comment approved event in workflow_ng, and I need that kind of feature, so I implemented it. See the attached patch. The event is triggered always when and comment state is changed from unpublished to published.
| Comment | File | Size | Author |
|---|---|---|---|
| workflow_ng_comment_approved.patch | 2.12 KB | sjs |
Comments
Comment #1
fago1. this patch has bad code style
2. this would create a query even when the event is unneeded. I won't do this in workflow-ng.
Perhaps you could achieve the same this way:
* write a comment load action, like the existant node or user loading action
* create a rule like this: on update, load the old comment, compare it with the new one...
I don't know if this approach really works, have a look at drupal's code...
Comment #2
sjs commentedIf I understood you correctly, you are suggesting using load $op for hook_comment in similar way that hook_nodeapi has load $op. It would not work becaus hook_comment does not have 'load' action (http://api.drupal.org/api/function/hook_comment/5). So, besides the method in the patch, I don't know any other way to determine if a comment is being changed from unpublished to published using the edit form. The hook_comment 'publish' $op works in most cases, but there some cases when admin would like to use the edit form instead of the admin/content/comment/list/approval -page to approve comments.
EDIT: I also tried loading the old comment using _comment_load function in hook_comment update action, but in that stage the resulting object had the new status already.
Anyway, If I would somehow manage to fix those two issues, would you consider the feature important enough to include in workflow_ng ?
Besides, if understood you correctly, and you are reffering to the "select status from {comments} where cid=%f" -sql query by your 2. point, I don't really understand how that is an issue.