Closed (won't fix)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
19 Feb 2009 at 09:44 UTC
Updated:
10 Nov 2018 at 19:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fagoYep that would make sense. Perhaps we can make the comment data type savable and do it like with nodes?
Comment #2
mitchell commentedThis would be an awesome feature, and a good place to start might be the "Add new content" action, under "Node."
I'm hesitant to send this over to Drupal core: comment.module, so I'll leave it here for now under "provided module integration." Since this issue is without sufficient interest, I'm also going to mark this postponed for now.
Comment #3
amitaibuLet's keep it active, I might get to it.
btw, It's doesn't need the 'Rules integration' tag - this is needed for other *contrib* modules integration with Rules.
Comment #4
amitaibubtw, thanks Mitchell for the issue queue cleanup :)
Comment #5
mitchell commentedNp, Amitai. Thank you for the feedback.
Comment #6
mitchell commentedMoving to core, removing rules tag.
Comment #7
mitchell commentedThe core developers don't seem too focused on actions. Moving back to Rules.
Comment #8
crizsubscribe...
Comment #9
Encarte commentedsubscribe
Comment #10
Azol commentedSubscribe
Comment #11
Witch commentedi am very interested in it!
*subscribe*
Comment #12
attiks commentedI needed this urgently so a quick stab at it, code added to comment.rules.inc but still needs some love
Comment #13
Witch commentedi will test it later!
thank you!
Comment #14
attiks commentedproblems i noticed my self:
- for the node and user you'll see too many options
- input format is blank for the moment, maybe better to turn it into an option
Comment #15
fagoPlease roll proper patches again the current dev branch.
Comment #16
attiks commented@fago (or anyone else)
can you help with my questions in #14?
Comment #17
fagoWith what specifically? What do yo mean with too many options?
This is already supported in 7.x, so any 6.x integration should use the same argument names than in 7.x in order to ease upgrading. For saving the comment, it should fix the comment data type to be savable and then leverage rules saving mechanism.
Comment #18
joecanti commented+1
This would be a good feature
Gave the code a quick test but got the following:
Fatal error: Cannot redeclare comment_rules_action_info() - line 214 of comment.rules.inc
Thanks, Joe
Comment #19
attiks commented@Joe
The comment_rules_action_info() function in #12 replaces the one that's already there.
Comment #20
attiks commented@fago,
See screenshot, I'm seeing users where I expect to only see nodes
Comment #21
zeezhao commentedsubscribing
Comment #22
fagoThe code looks good so far, I don't think it should show you a user. Try creating a new action, the existing one might have cached old action info.
Comment #23
joecanti commentedThanks attiks - removed the extra instance and worked great. works well for my needs, which is to use it as a vote counter. Am keeping an eye on the Rules integration for voting API which will be amazing, but for now this does a great job of counting votes. When a user presses a flag 'vote now' on a node, a +1 comment is added to that node, then the flag is taken off an a message displayed to the user - 'thanks for voting!'
Now the comment count is displayed as 'votes' and the content is sorted by comment count on a separate page, giving a nice ranking system. Will be interesting to see how it performs under lots of pressure - ie thousands of votes... Any ideas how it would cope? Design runs in panels and views - so the 'voted on' node never gets displayed - the comments never see the light of day... Just the parts of the node needed - ie the picture, title, comment count - votes, and a 'vote now' button.
Perhaps not the intended use, but seems to be more reliable than other work around voting systems I have tried to build...
Thanks again, Joe
Comment #24
zeezhao commentedHi. I tried it out and it works fine. The only thing is I am using it with a casetracker based module that publishes html as part of the comment. Hence some of the html came out in raw text...
So I support the need for "input format" as an option.
Also, I got a "warning: preg_match() expects parameter 2 to be string, array given in ....\includes\bootstrap.inc on line 777" after psoting the comment. Not sure yet what is causing it though i.e. either rules comment or casetracker
Thanks for providing this addition to rules.
Comment #25
attiks commentedNew version with support for input format, if ok i'll create a patch
Comment #26
zeezhao commentedThanks for the patch. I tried it briefly, and it does work fine.
However, I still get the error I mentioned in #24:
after posting the comment via a rule. But I can not confirm if the error is being caused by the casetracker module against which the comment is posted.
If no one else is seeing the error, then patch looks fine and will have to find out why casetracker is generating this. Thanks
Comment #27
attiks commented#26: I don't get the error even with casetracker (actually openatrium)
Comment #28
zeezhao commentedreferring to #27, thanks for your feedback. I am using latest casetracker 6.x-1.x-dev. Does openatrium still sync up with this?
I believe the error is caused by ct module, as after posting the comment via rule, the node always now gives that error message when trying to view it.... As I am not very familiar with its code, I posted this here:
http://drupal.org/node/826082
I think its something to do with how the Project gets posted.
Anyway, thanks for your help.
Comment #29
attiks commented#28: my mistake, the nodes i'm using it on are not casetracker-enabled nodes so i tested it on a case-node, but i don't get the error message
Comment #30
mehoo462 commentedThis works and is very awesome! Thank you.
One thing: tokens seem to work in the Subject of the Comment but not in the body. Is this a simple fix? I would do it if I knew anything about PHP. Any help would be greatly appreciated.
Comment #31
mitchell commentedHappy to see work went into this that could potentially get committed to 6.x, but feature requests are getting bumped now. I'm guessing this will be a lot easier in 7.x anyway. See #17 for some 7.x info.
Comment #32
fago7.x already supports creating comments, so working on a 6.x solution is fine now. But the 6.x solution should require the same settings as the 7.x version.
Comment #34
rickvug commentedAttached is the code in #25 as a patch. Only change is adding a comments for the functions and moving the form into comment.rules_forms.inc. Further reviews and testing surely needed.
@Fago - I don't see this action in Rules 7.x-2.x-dev. Is this where I should be looking to ensure that settings are the same as the D7 version?
Comment #35
rickvug commentedDoh! Forgot to attach the patch.
Comment #36
attiks commentedI think http://drupalcode.org/viewvc/drupal/contributions/modules/rules/rules/mo... is the file you're looking for
Comment #37
rickvug commented@attiks Yes, this is the file I looked at. I'd expect a function called comment_rules_action_info() but I don't see it. I don't think this is due to an API change as node.rules inc implements hook_rules_action_info().
Comment #38
rickvug commentedHere's a slightly updated patch. It fixes the arguments configuration and also makes the comment body field required. The base functionality is working but I've found a few issues:
- Token support is not working.
- Comment subject is not set automatically if you leave the field blank.
Comment #39
attiks commentedI think you have to code to have support for automatic title (see http://api.drupal.org/api/function/_comment_form_submit/6) and token support
Comment #40
rickvug commentedHere's an updated patch. This fixes the subject issue (@attiks - we're thinking on the same page). As for token support, 'eval input' is being set as follows:
This matches the values in the $settings array. Any hints as to why this is not working?
Comment #41
rickvug commentedSorry for so many updates as work progresses. Tokens are actually working. I just needed to configure the rule again for the change to take effect. Attached is the same patch as #40 with format no longer being evaluated (not sure why that was listed first time around).
Back to needs review.
Comment #42
klausi@rickvug: you can create a comment in Rules 7.x-2.x-dev with the action "Create a new entity".
Comment #43
rickvug commented@klausi Thanks. I looked at data.rules.inc but found the code difficult to follow to where the settings are defined. Settings such as $settings['entity:select'] and $settings['type'] don't look to line up with comments in D6. If you or someone else could provide more specific guidance on settings that would be helpful.
Comment #44
rickvug commented@fago I don't think that I fully understand Rules data types. In what way does this effect the action? I'm assuming that making the comment data type requires this change in class rules_data_type_comment:
And also setting the savable flag:
Comment #45
klausiI Rules 2 we have the following setting fields:
subject
node
author
comment body including text format
So that looks complete. I suggest to use "Add new comment" as label to be consistent with "Add new content" for nodes.
When I tested the action, I get a notice: "notice: Undefined index: cid in /var/www/klausi/web/drupal-6/modules/comment/comment.module on line 700.". So I think you want to set cid to 0 as well, I guess.
Comment #46
klausi@rickvug: don't worry too much about Rules 2 internals, fago just referred to the settings that are configurable in Rules 2. I think your solutions looks good and is nearly ready.
Comment #47
rickvug commentedAttached is an updated patch. The label has been changed as per suggestion.
@klausi - I'm not experiencing the same notice in testing. In any case, I've set $comment['cid'] = NULL and everything works. I get the same behaviour if I set ['cid'] to "0" or don't set it at all. My error reporting is set to E_ALL.
Setting to needs review. Fingers are crossed.
Comment #48
klausipatch is missing.
Make sure that you use Drupal 6-dev from CVS where such PHP notices are enabled and displayed as Drupal messages.
Comment #49
rickvug commented@klausi - Here's the patch that I was going to submit previously. I switched to using D6 dev checked out from CVS and could reproduce your error. Setting cid to NULL fixes the issue.
Comment #50
klausiuse the label from rules 2: "The author of the comment"
let's name this element "comment_body" to be consistent with rules 2
and this "comment_body_format"
Powered by Dreditor.
Comment #51
rickvug commentedAttached is an updated patch that contains the changes requested by klausi in #50.
Comment #52
klausiGreat, works for me. Leaving the final commit for fago.
Comment #53
YK85 commentedsubscribe
Comment #54
fagoPatch looks good, however as I've noted in #17 it should make use of the rules saving mechanism for comments to save it.
#17:
>For saving the comment, it should fix the comment data type to be savable and then leverage rules saving mechanism.
Once you've fixed the data type, you can use the node add action as example to follow.
Comment #56
Witch commentedAny news about this?
Comment #57
sreher commentedthanks for the patch - it makes some very nice features available. And it works great.
I discover an bug. The content and the subject of a comment isn't shown when you reload the page "Editing action Add new comment".
It saves the date in the database, but not loaded it again, so you have to put in new changed data to update it.
Where does the patch load the data from the comment to display it in the rules admin section?
Can anybody help?
Comment #59
baff commentedsubscribe
Comment #60
mbiddlecombe commentedsubscribe
Comment #61
Kman2123 commentedsub
Comment #62
Kman2123 commentedHow do you put this patch in? Any chance that it will be included in the dev release or recommended release?
Comment #63
Azol commentedI am currently preparing the new patch to meet the requirements that fago has outlined in #54. Hopefully it will be ready today.
Comment #64
Kman2123 commentedOh! That's great news! Thanks!
Comment #65
Azol commentedOkay, based on patch #51 and fago's recommendations #54.
Worked nicely for me.
I had some troubles with Git (was I the only one?) and Eclipse decided to screw up everything, but hopefully it will work...
Think I am going to assign it to myself since I desperately need this feature for my project...
Comment #67
Azol commentedOops, again
Comment #68
Kman2123 commentedI am new to patching, where do I insert this or how do I get it?
Thanks for your help!
Comment #69
Kman2123 commentedSorry I didn't mean to bump you off it!
Comment #70
Azol commentedhttp://drupal.org/node/620014 (automated) or
http://drupal.org/node/534548 (manual)
And please, do not change the status of this issue (http://drupal.org/node/156119) unless you absolutely must :)
Comment #71
Azol commentedGah
Comment #72
Azol commentedI found no problems with this patch so far, has anyone else tested it?
WTB RTBC :)
Comment #73
fagoThis would check access permissions on run-time what is wrong. If one configures a rule, one usually wants to perform regardless of the permissions of the currently logged in user. Thus if, any permission checks should be done when the action is configured + notify the site-builder of that behaviour. Thus, site-builders should be aware that creating this with a PHP input filter and custom tokens might be a "small" security hole. So maybe add a small note the config form.
BTW: I see no config form for the action?
Comment #74
chey commentedIs this still being worked on? Any updates? I'm not sure what fago is trying to say in comment #73.
Comment #75
Azol commentedHad no time to look into it yet. It's a week of work for me what an experienced drupaler will achieve in three minutes...
Comment #76
baff commentedis #67 the solution so far?
Comment #77
gkelly commentedsub. This would be a really useful feature when completed.
Comment #78
eg208 commentedsubscribe
Comment #79
eg208 commented#67: 376648-add-comment.patch queued for re-testing.
Comment #80
klausistop subscribing, start following http://drupal.org/node/1306444
Comment #81
fagosee #73
Comment #82
Azol commentedNew patch:
1) added settings form
2) removed comment subject truncation at the moment until I can find a better (more secure?) solution
Known bug: if commented node contains CCK user reference fields, they become NULL for some reason. Would be great if someone could help troubleshooting this issue.
Comment #83
attiks commentedComment #84
Azol commentedSetting this back to Needs work due to the bug I described. Any help with troubleshooting is welcome!
Comment #85
mitchell commentedUpdated component.
Comment #86
nicodv commentedIs there a patch that does this in d7?
Thanks
Comment #87
IWasBornToWin commentedat #86, you dont need a patch for d7, you can do it under "add new entity" and then choose, "comment"
Comment #88
kopeboyActually you can't if the comment body field is set to plain text.
This is a bug instead.
There are no data selectors for it.
You decide if it's better to fix the bug (Create a new entity of type comment) or do the (new feature) action "Add comment".
This might be relevant: #1770440: Text comparison on comment-body:value not working if Comment set to Plain text processing
Comment #89
tr commentedThis issue is a D6 issue, or at least it was until the last comment #88. I'm not sure why it was moved to D7 - the D7 issue described in #88 is being handled by #1811812: Creating a Comment directly after saving a node. and #1770440: Text comparison on comment-body:value not working if Comment set to Plain text processing
Marking this current issue as won't fix because it was about D6 and D6 has not been supported for almost three years now.
Comment #90
tr commented