Needs review
Project:
Feedback
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
2 Jan 2009 at 16:30 UTC
Updated:
3 Mar 2013 at 19:28 UTC
Jump to comment: Most recent file
While storing the feedback in the DB table is important, in many use cases, the feedback needs to go to someone, and email is clearly the best answer. How about adding a 'feedback email address' admin setting (if empty, we won't send email, same as now), and then firing off a quick drupal email as part of feedback_add_entry or feedback_form_submit?
That way, if a user sees something (critically?) wrong, instead of the note sitting in the db waiting for someone to look for feedback, an admin can be proactively warned of the trouble, or if it's not important, ignore/delete the email, knowing that a copy of the feedback is in the db for later.
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | feedback-353548-45.patch | 10.81 KB | jody lynn |
| #40 | 353548-40.patch | 10.81 KB | jody lynn |
| #39 | 353548-39.patch | 6.58 KB | jody lynn |
| #34 | actions.patch | 7.37 KB | jody lynn |
| #28 | feedback-353548.patch | 8.6 KB | geodaniel |
Comments
Comment #1
sethcohn commentedJust saw #349288: Send an e-mail to admin? is marked as Won't Fix.
Will you take a patch that adds the above?
Comment #2
sunWould you agree that this won't fix, if we would implement #351698: Use entities for Feedback messages? New features go into 6.x first, and in 6.x, there are default actions for the "node creation" trigger. My point is that I would want to configure the recipient's mail address (and not bug the site owner, resp. client with feedback messages), but the whole mechanism would already be available in Drupal core if Feedback would use nodes to store feedback messages.
Comment #3
sethcohn commentedI agree that would solve it for D6, and potentially for D5 (since there are similar means (actions/workflow) to do the same), but it seems _a lot_ of work for something that really is only about 20-30 lines of code to add otherwise (admin settings form with a variableset for the feedback_emailaddress, plus a drupal mail call if the variable is set). I agree, it should be a configurable email address, not the default site owner email.
As I asked, would you take such a patch? I see that both are valid approaches, and actually complementary (if other means for node notification exist, you can just not set the built in feedback email address, to turn off that functionality)
Comment #4
sunYes, if it is clean & solid, and does not become burden with me. ;) I'd rather like to invest time in the back-end abstraction / node based back-end...
Comment #5
brian_c commentedI would also be very interested in a patch that supports notification. Storing it in a database is awesome, but there should be a way to have it sent to someone, or at least notify them of a new entry.
You shouldn't need to constantly check a log, just to handle user feedback in a timely fashion.
Comment #6
mrfelton commentedI agree that the node based / trigger approach would be a better end solution, but a quick and dirty configurable email address to send notifications to would be a nice added feature for now.
Comment #7
radj commentedme agree.
Comment #8
sethcohn commentedI have a working version of this, and will post a cleaned up patch for 5.x shortly. I plan on a 6.x patch (the mail calls are different between 5.x and 6.x) but haven't had the time to work on it yet.
It'll use a themeable mail call, allowing for more or less custom mails if desired. For instance, I've added a tab delimited dump after the normal text, to allow a QA person to cut and paste the data as one line into an Excel sheet.
I attempted to test the browscap functionality, but browscap is currently broken.
Comment #9
brian_c commentedI have added a hook to my copy of this module, in the feedback_form_submit() function. This allows me to intercept the feedback submission in another module (our custom project module) and take whatever action we wish.
In the function feedback_form_submit(), I have added this as the first line:
Now, in a module called 'foo', we can create a function foo_feedback_form_submit(), and it will be called whenever feedback is submitted.
Sun, any chance of adding this hook to the module? It is trivial to add, and provides an enormous increase in flexibility to developers.
Here is my custom module's implementation of this hook (with names changed to protect the innocent), which sends out a notification email to all users with a particular role ID:
Hope this helps someone.
Comment #10
sethcohn commentedSorry for delay... We've ended up using this with great success for multiple sites.
By using an admin setting form to set the destination email, and a themeable call for the mail itself, it's very customizable.
I agree, a form_submit handler like brian_c's patch would also work, but then it requires an extra module to do anything, meaning the out of the box experience is still lacking what so many agree is pretty basic functionality. The advantage of this patch is that it's self contained, yet still flexible enough to completely revamp or change. If both methods (theme call, and submit handler) are used, so much the better for maximum flexibility on the part of developers.
For example, I added a single line (which is in the patch, commented out, mostly as an example) that then includes a cut/paste version tab separated line of the data, to allow someone to easily paste everything into a spreadsheet with columns). Other future plans include adding other exporting/transmitting of the data, but now I could do that externally in the theme, or via brian's suggested hook.
Comment #11
brian_c commentedAbsolutely, I would love to see an "out of the box" solution for notification as well. It sounds like Sun wants to implement this using Nodes though, so I'm thinking that won't be for a while.
In the meantime though, I'm happy with my one-liner hook addition... trivial to re-add if the module is updated.
Ideally, we could have both. Admin interface for ease of use, hook for maximum flexibility.
Comment #12
sethcohn commentedActually, in our current use case (client feedback post-development, prelaunch) we don't _want_ nodes, since we want the minimum impact on the site possible (ie a standalone table is perfect, that we can drop once the feedback phase is done with) We want to turn the module on/off with no noticeable impact on the db itself. Turning feedback items to nodes would end up a problem, in this use case, since we'd be adding content to the site itself and have to deal with that.
If Sun ends up putting that feature (http://drupal.org/node/351698) into the module, I hope it's optional.
Comment #13
jcruz commentedI thought if I attached a patch, sun might be more likely to commit :)
Patch adds brian_c's hook from #9
Comment #14
sunWell...
1) This patch contains coding-style issues.
2) It does not add the requested functionality. Instead, it defers to a yet-unknown (any) module to take over the notification.
Comment #15
jcruz commentedsorry about that. sloppy copy and paste. also just realized it's just as easy to form alter and add a custom submit function.
Comment #16
sunok. So what I want to see here is an implementation of actions (and triggers), because that's a future-proof way of doing things. That way, the e-mail notification is configurable, can be toggled, and users could even assign other actions to Feedback's trigger (f.e. displaying a message or whatever).
Comment #17
scottrigbyImplementing triggers / actions would be ideal.
Comment #18
jordanmagnuson commentedAgree. Subscribing.
Comment #19
antgiant commentedAttached Patch does the following.
Hope it helps.
Comment #20
jordanmagnuson commentedThanks for your work antgiant.
Any chance of a 5.x patch?
Comment #21
antgiant commented@davidlerin not from me. Sorry.
However, the Actions project (http://drupal.org/project/actions) may cause this patch to work in 5.x. (I can't verify as I don't have any 5.x installs.) Hope that helps.
Comment #22
smk-ka commentedNote that the original issue was about sending an e-mail to a list of addresses (usually site admins or developers) while the latest patch sends an e-mail to the user who was giving the feedback. I've taken antgiant's patch from #19 and developed it a bit further:
- Added a configurable list of recipients to the action.
- The primary object passed to actions should not be a user object but an instance of the feedback object itself.
- Also feedback is NOT node-specific, so I've completely removed the node/taxonomy stuff used in the e-mail generation. Instead you have now access to almost all feedback object properties.
- If there can be found a way to #470146: Track title of current page, we could add another replacement token for it.
This patch is completely UNTESTED.
Comment #23
antgiant commented@smk-ka You don't need to modify the action I provided to send it to a list. You can use the existing action provided by the system module to "send email...". I like the idea of sending the feedback object as the primary object. I just wasn't sure of its impact on existing user and system actions.
Comment #24
pescetti commentedSubscribing.
Comment #25
pvhee commentedsubscribing
Comment #26
pvhee commentedIn #492094: Rules integration: rules event when submitting feedback I have submitted a patch that provides integration with the Rules module, a more powerful approach to core actions/trigger
Comment #27
Progression commentedSubscribing
Comment #28
geodaniel commentedAttached is an updated version of the patch from #22 which fixes some issues (like not having access to the variables when sending the message) and seems to work ok for me.
Comment #29
charos commentedI can see the action but how is this triggered? Just setting the action doesn't send any email.
Comment #30
geodaniel commentedOnce you have an action configured (at admin/settings/actions/manage) you should go to admin/build/trigger/feedback and assign that action to the 'After feedback has been submitted' trigger.
Comment #31
charos commented/admin/build/trigger/feedback gives "You are not authorized to access this page. " - access denied. I am uid/1 so something is wrong with the patch.
Comment #32
geodaniel commented@charos, have you tried clearing the menu cache to see if that had an effect?
Comment #33
charos commentedcleared all cache few times,run cron , nothing changes.
Comment #34
jody lynnUpdated patch fixes a couple of things (the interpretation of 'status' was inverted in previous patch).
Unfortunately core actions in 6.x expects the use of a hook_feedback with an $op parameter, so we do have to do it this way.
I tested it and all the token replacements are working.
I'm going to try to extend it to work with rules to combine this with #492094: Rules integration: rules event when submitting feedback.
Comment #35
sunWe should do #402438: Add proper API functions and hooks to allow other modules to interact with Feedback messages first.
Minor issues of the current patch:
Trailing white-space.
1) Bogus indentation.
2) (Always current) coding standards for hook implementations are "Implements hook_FOO()."
Powered by Dreditor.
Comment #36
jody lynnComment #37
jody lynnComment #38
jody lynnComment #39
jody lynnThis still needs some work, commenting and testing. I want to add an action to delete an entry as well and test this out with flag_actions module to see if this will work well in combination with #453820: Views integration to allow changing the feedback entry statuses with flag.
Comment #40
jody lynnHere's a new patch that I think is ready to go. Includes tests.
Once this goes in I can work on #1089318: Flag integration and #675092: bulk clear/remove feedback messages
Comment #41
dwhutton commentedSubscribe.
Comment #42
jody lynn@dwhutton please use the 'follow' button on the top of the issue
Comment #43
mattbk commentedThe patch in #40 allows sending an email which is parsed and received correctly, but if I go back to the Actions page and click "configure" on the "Send email of feedback" action, I get an empty form (that is, I would have to reconstruct the entire form, not just edit it with different information).
Comment #44
marameodesignI have tried to apply the patch, but nothing happens. I can not access to /admin/build/trigger/feedback - nor I can see any new action. Perhaps I am missing something.
Comment #45
jody lynnmarameodesign: This patch is for Drupal 7.
Here's a new patch to fix the issue in #43.
Comment #46
sunHm. I wonder whether this is architecturally + strategically the proper way...?
Technically, we're implementing a standard/common entity now — are we sure that there is no way to relay almost all of this code and logic to the Entity API module?
At least, most of this looks so generic to me that I can't really believe that Entity API + its ecosystem doesn't provide generic solutions for all entity types already...?
Anyone familiar with that? :)