Notify Organic Group Members for Webforms and Rules in Drupal

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?



Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <img> <td> <th> <tr> <br> <div> <span> <hr> <b> <i> <map> <area><h1> <h2> <h3> <h4> <h5> <p> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Insert Google Map macro.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.