Closed (fixed)
Project:
Rules
Version:
6.x-1.4
Component:
Rules Core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Mar 2011 at 02:52 UTC
Updated:
24 Jun 2013 at 01:43 UTC
I know that title's fairly vague but I'm not sure of how many ways there are to acheive this so I didn't want to be too specific.
I have had a play with the following modules but I'm still a little stumped:
Insert View
Viewfield
Rules and Views Integration (with Views periodic execution)
I realise that I may need the Mime Mail module in order to send the View as HTML.
I've seen other issues along the same lines as this but they assume a certain grounding that I seem to be lacking (particularly regarding Rules and Views Integration).
Any help (small prompts right through to full-on how-to guides) would be greatly appreciated.
Comments
Comment #1
bshensky commentedSubscribing. I'm in a similar situation, so I'll be happy to share what I uncover.
Comment #2
itangalo commentedI don't think there's a module that does this, so accomplishing it will require some coding.
There are basically two approaches to doing this:
1) Use PHP and embed the view in the e-mail message directly in the Rules configuration. This is *not* recommended, since storing PHP in your database is bad for several reasons.
2) Write a small Rules plugin, that allows you to load the content of the desired view as a string. (Or even to load an arbitrary view, which would be a neat plugin to contribute to the community.)
Both these approaches would make heavy use of the Views API, in a way similar to this:
NOTE: The Views module must be loaded to make use of the functions above – unless the module_exists() function loads Views automatically.
A good place to read more about Views API is drupalcontrib.org – for exmple http://drupalcontrib.org/api/drupal/contributions--views--views.module/f....
I hope this can be of some use to get started. Good luck,
//Johan Falk
Comment #4
bshensky commentedI said I'd follow up. Here you go! Here is the skelton of the formula I have put together to have a view sent nightly to all users of a role nightly. It uses Rules, Rule Sets, Rules Scheduler and Views to do its magic. You will have to salt and pepper it to your situation, but the fundamentals are there.
For nightly reporting:
Once this is put in place, you must use the Rules Scheduler UI to schedule the initial run (admin/rules/rule_sets/scheduling).
Comment #5
dddbbb commented@bshensky Wow, thanks for this. I look forward to giving this a try...
Comment #6
pribeh commentedsubscribe
Comment #7
landing commentedsubscribe
Comment #8
dreadlocks1221 commentedHi,
I set this up with rules in D7 and when the email sends out, it send 10 copies. Is there a way to fix this?
Comment #9
lomo commentedThe existing issue and code, etc, in this is all about Rules 6.x-1.x, not 7.x-2.x. I don't think the version of this "issue" should be changed when someone has a related question (bug). ;-)
Comment #10
tajindersingh commented@bshensky
Thanks for such detailed steps. Really helped.
Just found that Token 1.7 broke Rules integration, but Token 1.18 works fine.
Here sharing just in case someone like me in help come this view so should get confused.
Thanks again.. :)
Comment #11
sorensong commentedDo you know of a way to do this in D7? Is "Rules and Views Integration" the missing element for D7 users?
Comment #12
marcusx commentedNot nice but working for now. I did it with enabling the php filter and using a small snippet in D7. In the body field:
Comment #13
mrpeanut commented@marcusx — Just wanted to thank you for posting that code. Hours of frustration solved by your comment. I took out a few lines, but it is essentially the same:
Comment #14
memcinto commentedbshensky: Wonderful - thank you. Saved me hours of work. FYI if you are trying to send HTML email via Mime Mail, you'll need to use [rendered_view:string-raw] instead of [rendered_view:string]. Thanks again.
Comment #15
mitchell commentedUpdated component.
Comment #16
rsutaria commentedFor Drupal 6.x, you can try this module:
http://drupal.org/project/sunmailer
Comment #17
aidanlis commentedFor Drupal 7, you can use http://drupal.org/project/mailaview
Comment #18
micnap commentedTriggered by a rule? I'm not seeing any rules integration in mailaview.
Mickey
Comment #19
dkhill commented@bshensky
I came back to look at this thread looking for a solution for a Drupal 6 web site. Thanks for providing this snippet of information. I'm in the process of putting together the pieces. I came across where you mention "rules_periodic_execution" module, but I couldn't find it. When I installed the "Rules & Views Integration" (rules_views) module it mentioned the dependency as "Views_periodic_execution". That one exists. Assuming this is what you meant, I went ahead and installed that module.
I'll post my findings here.
-d