Share this
Drupal Rules: My New Drupal Best Friend
by Harold Knieriem on Thu, Sep 04, 2014 @ 08:30
Not too long ago I heard a Drupalista speak of how long it takes to learn Drupal. He said it took four to five years. I found this to be true so far. I am approaching two years of developing in Drupal. It seems to me that the learning curve is more steep than flat.
I think I hit a learning plateau for a little while, but over the past month I have a new friend in Drupal modules. What is this module? Rules. Now, I have used this module before to do some complex order of items, but I never really understood exactly what they were doing.
How to Use Drupal Rules to Send Blog Notifications to Subscribers
A couple of recent projects brought me to a greater understanding of the Rules module. The first project required sending blog subscribers a notification of new blog content. For this I used the Simplenews module to deal with the subscriptions and Rules, Mimemail and Simplenews Rules to create and send the emails.
- To set it up, I started by creating events of “After saving new content” and “After updating existing content” and set both to act on the blog node type.
- For conditions, I created “Content is published” for the node.
- I added a boolean field to the blog content type named “Newsletter sent” and set its default value to FALSE, then created a “data comparison” condition on the newsletter sent field to equal FALSE.
- For the actions, I started by creating a new newsletter entity.
- I set the title and body fields using the blog node data and the newsletter category appropriately.
- I then had to set up an action to forcibly save the newly created newsletter, so that it could be sent with the newly set fields.
- I then set the newsletter sent field to TRUE.
- Finally, I created an action to send the newsletter.
How to Use Drupal Rules to Send Webform Data into a Database
Another project was for my church. We are setting up Drupal as our membership management software. The goal was to have a visitor form capture new visitor information and send it to the appropriate people. This is done by a simple webform. We also needed to get that webform data into the membership database and that’s where Rules fit in so well. The modules I used were Rules and Webform Rules.
- To start, I used the “After a webform has been submitted” event.
- I set the condition to “Webform has name” and set the value to the visitor’s webform.
- Actions I added include “Add a variable” to store webform data, an action of “Create a new entity” type of member to create the member, and then a couple actions of “Set a data value” to set the member field data.
- And again, an action to forcibly “Save entity” on the member.
As I am still new to understanding Rules, there are a few things I am still digging into. One thing is how to determine if a node exists with a specific field value, and if not create a new entity. I think this may be done by chaining rule set and rule components. This is next part I am learning more about.
After two years of developing in Drupal I have learned a lot, but still see so much more to learn. Not to mention the new developments in Drupal 8 that are coming in the near future.
Do you have any tips for Rules? Please share in the comments below.
Another post about Drupal from Harold:
9 Drupal Modules That Should Be Part of Every Website Build
Image: The Drupal Five by Gabor Hojtsy via Creative Commons Attribution-ShareAlike 2.0 Generic License
Share this
- Inbound Marketing (126)
- Manufacturing (82)
- Lead Generation (70)
- Website Design & Development (58)
- Social Media (46)
- Online Brand Strategy (38)
- eCommerce (33)
- B2B Marketing (31)
- Digital Marketing (29)
- Expert Knowledge (29)
- Company Culture (22)
- Content Marketing (16)
- Customer Experience (15)
- Metrics & ROI (15)
- Search Engine Optimization (15)
- Marketing and Sales Alignment (12)
- Transportation and Logistics (11)
- Content Marketing Strategy (9)
- Email Marketing (9)
- SyncShow (9)
- Digital Sales (8)
- General (8)
- Lead Nurturing (8)
- Digital Content Marketing (7)
- Mobile (7)
- Brand Awareness (6)
- Digital Marketing Data (4)
- Transportation Insights (4)
- Video Marketing (4)
- LinkedIn (3)
- Professional Services (3)
- Demand Generation (2)
- High Performing Teams (2)
- News (2)
- PPC (2)
- SEO (2)
- SSI Delivers (2)
- Synchronized Inbound (2)
- Value Proposition (2)
- Account-Based Marketing (1)
- Facebook (1)
- In-House Vs. Outsourced Marketing (1)
- Instagram (1)
- KPI (1)
- Marketing Automation (1)
- Networking (1)
- Paid Media (1)
- Retargeting (1)
- StoryBrand (1)
- Storytelling (1)
- December 2024 (2)
- November 2024 (4)
- October 2024 (4)
- September 2024 (4)
- August 2024 (4)
- July 2024 (1)
- June 2024 (1)
- May 2024 (4)
- April 2024 (1)
- March 2024 (3)
- January 2024 (2)
- December 2023 (4)
- November 2023 (3)
- October 2023 (1)
- September 2023 (4)
- August 2023 (3)
- July 2023 (2)
- June 2023 (2)
- August 2022 (2)
- July 2022 (2)
- June 2022 (1)
- March 2022 (2)
- February 2022 (1)
- January 2022 (2)
- October 2021 (1)
- June 2021 (1)
- May 2021 (1)
- March 2021 (1)
- December 2020 (1)
- October 2020 (2)
- September 2020 (1)
- August 2020 (3)
- July 2020 (3)
- June 2020 (4)
- May 2020 (2)
- April 2020 (3)
- March 2020 (9)
- February 2020 (5)
- January 2020 (6)
- December 2019 (5)
- November 2019 (7)
- October 2019 (6)
- September 2019 (8)
- August 2019 (5)
- July 2019 (5)
- June 2019 (3)
- May 2019 (2)
- April 2019 (1)
- March 2019 (2)
- February 2019 (1)
- January 2019 (2)
- November 2018 (1)
- October 2018 (1)
- September 2018 (1)
- August 2018 (1)
- May 2018 (2)
- March 2018 (1)
- November 2017 (1)
- October 2017 (1)
- September 2017 (1)
- August 2017 (2)
- July 2017 (2)
- May 2017 (1)
- April 2017 (1)
- February 2017 (1)
- January 2017 (1)
- December 2016 (1)
- November 2016 (8)
- October 2016 (7)
- September 2016 (2)
- August 2016 (2)
- July 2016 (6)
- June 2016 (3)
- May 2016 (4)
- April 2016 (6)
- March 2016 (6)
- February 2016 (7)
- January 2016 (7)
- December 2015 (6)
- November 2015 (2)
- October 2015 (3)
- September 2015 (2)
- August 2015 (4)
- July 2015 (9)
- June 2015 (9)
- May 2015 (8)
- April 2015 (8)
- March 2015 (9)
- February 2015 (7)
- January 2015 (8)
- December 2014 (7)
- November 2014 (7)
- October 2014 (5)
- September 2014 (4)
- August 2014 (4)
- July 2014 (5)
- June 2014 (4)
- May 2014 (5)
- April 2014 (4)
- March 2014 (7)
- February 2014 (9)
- January 2014 (7)
- August 2013 (2)
- July 2013 (4)
- June 2013 (6)
- May 2013 (7)
- April 2013 (7)
- March 2013 (8)
- February 2013 (5)
- January 2013 (7)
- December 2012 (4)
- November 2012 (4)
- October 2012 (2)
- September 2012 (1)
- July 2012 (1)
- April 2012 (4)
- March 2012 (5)
- February 2012 (2)
- January 2012 (3)
- November 2011 (1)
- May 2011 (3)
- April 2011 (1)
- March 2011 (1)
- February 2011 (1)
- December 2010 (2)
- November 2010 (3)
- August 2010 (1)
- July 2010 (1)
- May 2010 (2)
- April 2010 (1)
- January 2010 (1)