This is related to #353548, but focuses on the contrib module rules instead of the core triggers/actions.
Attached in the .tgz are two files:
- patch for feedback.module, which invokes a rules event ("feedback_add_entry") when new feedback is added. For now, only the user providing the feedback is passed on, but I am working on passing the message, the location and all other relevant data as well.
- file 'feedback.rules.inc', which defines the feedback event. This allows the rules module to use this event.
You can now easily send out emails whenever new feedback is added, or any other action provided by rules or contrib modules, using the entire $user variable.
Would there be a possibility to add this patch to the rules module? If so, I will elaborate on the implementation in feedback.rules.inc, providing more data for conditions and triggers.
Comments
Comment #1
pvhee commentedI forgot the [ ] around the issue I refered to, here it is: #353548: Add trigger/action for e-mail notification
Comment #2
pescetti commentedsubscribing
Comment #3
sethcohn commented+1
Comment #4
pvhee commentedHere is a new patch, passing the feedback message and location as arguments in the event (as rules strings). Now you can use those in your actions/conditions, eg to send out email with the actual message and the location it was submitted at.
Coding conventions of the patch have been checked as well, and I've successfully tested it already on multiple sites.
Comment #5
pvhee commentedAny feedback on this? Could this be included in the latest dev? Thanks!
Comment #6
ayalon commentedCool patch. I implemented it in my own feedback module and it works quite well! Thanks! (PS: Maybe is posting text files more convinient for admins to check your patch)
Comment #7
sunCould you please provide a proper patch? See http://drupal.org/patch for further information.
Comment #8
pvhee commentedAttached is a proper patch.
I now pass the following variables to the rule: user, feedback message, feedback location, masked path location and the HTTP_USER_AGENT.
Comment #9
sunTrailing white-space here.
"@file" should be on an own line, "Rules integration..." right below it. Also note proper capitalization for "Rules" and "Feedback". And there should be a trailing period (full-stop).
I think we should label this event "Feedback is submitted" - or - any better suggestions welcome.
Shouldn't this be lower-case? (sorry, I'm not very familiar with Rules)
I think the key should be "message" instead of "feedback".
Also, all labels should be properly capitalized, i.e. "Feedback message".
"Feedback location masked" we should change to "Feedback location (masked)".
Beer-o-mania starts in 24 days! Don't drink and patch.
Comment #10
pvhee commentedThanks for reviewing the patch. I've changed the patch to accommodate to your comments. I haven't changed the capitalization in all cases though, as I'm following the standards set by Rules. Example:
Should be "feedback message" instead of "Feedback message". Same for "'module' => 'Feedback'".
Comment #11
kyle_mathews commentedI applied the patch -- and it almost works. I can create a rule but the tokens are all wrong except for acting user. The other token patterns only show generic global tokens. For example, there's no token to place the feedback message in the email.
I don't really know enough about rules to be much help beyond that.
Comment #12
socialnicheguru commentedCan I use Rules to copy the feedback message and other information to Case Tracker? has anyone tried this?
Comment #13
summit commentedSubscribing, greetings, Martijn
Comment #14
awolfey commentedWith the last patch the message results are available as php variables, but not tokens.
Comment #15
ensnaregod commentedso how would someone go about utilizing the php variables in the triggered rule email?
Comment #16
joostvdl commented+1
Comment #17
snorkers commentedI added the patch at #10 (thanks @pvhee) and works with 6.x-2.1. It's functional although I don't seem to have many of the tokens working yet - as also mentioned in this thread. The exposed PHP variables do the job, but the tokens issue is a bar to incorporating this into the module.
I think once the tokens become a little more usable, this functionality should be included into the module.
Comment #18
andrewcheetham commented+1
Comment #19
socialnicheguru commentedI can't seem to find the entry in rules for feedback.
1. Is feedback.rules.inc supposed to be in it's own directory called "feedback"? After I apply the patch, the path is feedback > feedback > feedback.rules.inc
2. I do not see feedback anywhere in rules section. I created a rule and looked under "condition to add" and "action to add" and I do not see a reference to feedback rules.
any help would be greatly appreciated.
Comment #20
jody lynnRules integration will be simple to add once the entity integration is added: #351698: Use entities for Feedback messages
Comment #21
chien_fu commentedIs this still being addressed for D6? This seems like a critical feature.
Thanks, subscribing.
Comment #22
jody lynnNew features go in the 7 branch, and once there we can consider a backport.
Comment #23
jody lynn#351698: Use entities for Feedback messages has landed, so time to add this
Comment #24
rkarajgi commentedI am using - feedback-6.x-2.2 - it is great. It makes it a very good user experience for the site.
Right now, when a user submits feedback - one can see the msg in admin/reports. I am trying to use the Rules such that it sends out a email. I did not find any feedback related event in rules.
The patch in #10 seems to be for feedback-6.x-2.1. Has anyone tried it on 6.x.2.2?
Thanks
Comment #25
jeremdow commentedNew patch against 7.x-2.x HEAD - also adds token support for send mail actions.
Please review - working fine for me.
Comment #26
dagomar commentedHi __rajeev
the patch works.
Comment #27
jeremdow commentedAnyone have a chance to review my patch for 7?
Comment #28
sunDoesn't seem to be needed, as they don't seem to contain classes.
Shouldn't this be properly capitalized?
1) Shouldn't the label be "Feedback message" ?
2) Isn't this variable the same for all possible events?
Comment?
That's a very weird way to define an array. I'd suggest to build a $types array and a separate $tokens array and return those two arrays in 'types' and 'tokens'.
Trailing white-space.
This needs to be used for the token replacements.
This should actually be resolved into feedback:author:*
I don't think that this token is useful in anyway.
Comment #29
adamgerthel commentedWe've used the patch from #25 for a couple of weeks now with no hickups. Seems to be working as intended
Comment #30
SebCorbin commentedPatch as per #28
Comment #31
SebCorbin commentedBad PHPStorm, bad!
Comment #32
SebCorbin commentedBad developer... (forgive me for spamming, need to get sleep)
Comment #33
Joseph_Fowler commentedWe are using the patch from #25. Does the job well. Would be great if this could be added to the module.
Comment #34
jody lynnConfirmed the patch in #32 addressed the notes in #28.
Now that feedback entries can be edited. This should be expanded to have a trigger on updating as well as inserting. Possibly on deleting as well.
Comment #35
parasolx commentedConfirmed patch #33 worked without any problem.
Comment #36
jody lynnNeeds work for issues in #34
Comment #37
javier.drupal.2012 commentedI made the chenge and it is working like a charm. Thanks for your work
Would be awesome to commit the patch in the last version
Thanks heaps
Comment #38
javiersalado commentedHello there,
I applied the patch successfully but when Adding a new rule I can't se the Feedback event as defined in the feedback.rules.inc so basically is not working for me.
Am I missing something? I have flushed caches and reset and restarted anything that came to my mind...
Thanks,
J.
Comment #39
jody lynnPlease do not change the status of an issue in progress.
We can't provide support to development patches.
Comment #40
jaydee1818 commentedThis works for me to a point.
If I create a rule that sends an email, it works if I put random text in the mail body.
However, if I want the actual feedback to be sent and I enter:
echo $feedback;in the mail body, I am returned the following error message:
Comment #41
jaydee1818 commentedActually, figured it out:
print $feedback->message;Comment #42
BrockBoland commentedAdded an update event to the Rules config.
This still needs some tweaking to make it more useful, though. If feedback implements
hook_entity_property_info(), it can provide additional information via Entity API that can then be used…I think.For example, I want to define a Rule that will act only when an existing Feedback entity is updated and the status is set to Processed. Right now, the
statusproperty is not available through the data selector in the Rules interface, because Rules doesn't know about it.I'm going to take a stab at this.
Comment #43
BrockBoland commentedThis is only a slight change from 42. Rather than sticking the
rules_invoke_event()call into the form submit handlers (booo), I implementedhook_feedback_insert()andhook_feedback_update(), since both of these are invoked fromfeedback_save(). This way, the rule will fire regardless of where the Feedback is changed or created from (for example, if a custom module programmatically creates or modifies feedback).Comment #44
BrockBoland commentedThis patch adds two things from the last one:
I also included an interdiff from the last patch on comment 32, to show all of my changes and updates together.
Comment #45
bendev commentedThanks for your useful patch.
I tested the author and timestamp sucessfully
Comment #46
kmajzlik commented#44 works well but fid (feedback id) token should be also added.
Comment #47
paulap commentedHi! Works well. thx
But instead of the author i get "Array" (i use [feedback:author]).
Comment #48
kmajzlik commentedI think it is ok, try to use [feedback:author:mail]
Comment #49
paulap commentedhi karlos007!
thx for your response #48.
But this doesn't work too. I tried [feedback:author:mail] and [feedback:author:name]. But it shows always "Array" as the placeholder/token value.
Comment #50
kmajzlik commentedpaulap: sorry, ma fault. I took it only from my head and wrong. So i took a look in existing rule:
So final solution:
1) add action: Fetch entity by property, type = user, value = user id, data selector = feedback:author:uid, entity name = author
2) address is available in next action as [author:0:mail] (note: author means a name of variable from step 1)
so as i look you can also first try token [feedback:author:0:mail]
Comment #51
paulap commentedThx karlos007!
It works perfect...
Comment #52
jody lynnI added fid as one of the properties. (I use that to construct a link to the feedback view page)
Comment #53
aron novakIt seems the patch is stable, I tested with a real rule, the fields are available in Rules, it seems it's ready to go.
Comment #55
jody lynnhttp://drupalcode.org/project/feedback.git/commit/36b256f
Comment #57
mfbPart of this patch got lost along the way! The tokens part, which is pretty important :)
Comment #58
wylbur commentedThe patch in #57 does bring back the tokens, but a number of them do not work.
I was able to fix the feedback url with this:
- $replacements[$original] = url($feedback->url, $url_options);
+ $replacements[$original] = url(drupal_get_path_alias($feedback->location), $url_options);
I was not able to get feedback:author to work, it just returns Array. Even using feedback:author:name does not work.
Comment #59
mparker17When I use the 3.x version of the Feedback module with Rules 4.0.1, I can create reaction rules on the event "After saving a new feedback message entity". Further, the 3.x version has good integration with the the ECA module as well (ECA is a popular alternative to the Rules module in 2026).
The Drupal 7 version of Feedback is no longer available, and no longer maintained. (If you'd like to maintain the Drupal 7 version, please post an issue in the queue)
So I'm going to close this issue as outdated.
Thanks in advance for your patience and understanding as I try to clean up this project's issue queue!