March 11, 2011 | by Jeannette Modic | Posted in CMS, Web Development
Don't you hate when it takes hours to find a solution for a specific Drupal problem? This recently happened to me when trying to find out how to email all the members of an organic group when a webform is submitted and as an action for Rules. In an effort to hopefully save you some time in the future, I want to share with you the solutions I found in one neat place.
Problem 1: Client needs to send an email to all members of an organic group whenever a webform is submitted.
Solution: With the new webform module, you need to write a custom module to add advanced validation and/or advanced submission. The details for how to do this are all laid out here. We also found some code here to put in our new custom module that grabs the values we need and send the email. To customize that code to send an email to all the members of the group, you will need a database query to pull the email addresses for all the members of your group. And that's it!
Problem 2: Build a custom action that we could use in Rules to send an email to all the users of our organic group whenever triggered
Solution: We were able to solve this problem by writing another custom module. All the instructions for this custom module were detailed thoroughly in this tutorial by Sthlm Connection.
Both of these solutions required custom modules, something I don't have a lot of experience with, so the idea of creating two was very intimidating. I found that, with the great support of the Drupal community and the excellent documentation out there, building custom modules isn't as difficult or scary as it seems. I was successfully able to implement these solutions, and so can you!
Have you ever written a custom module? Was it easier or harder than you thought?
8136 Old Keene Mill Road, Suite 207A, Springfield, VA 22152 | Phone: 703.451.8675 | Fax: 703.783.0392
© Copyright 2011 Balance Technology Group, Inc.
Comments
Post new comment