Flag Module - Sending Flagged Nodes

Events happening in the community are now at Drupal community events on www.drupal.org.
yellowhousedesign's picture

Hi, I was informed of the Rules module by a member on the Drupal forums - and was extremely pleased with such a powerful module - and after digging into Rules a bit more, have come to a bit of a snag.

I saw the integration with the Flag Module http://drupal.org/project/flag - which is great http://drupal.org/node/407070

From what I tested, based on when a user marks a node as a favorite, it can perform an action (in my case, sending an email to an administrator). What I want the ability to do, is to be able to collect a group of bookmarked content - and then based on the user's discretion, then send out an email to an administrator with some type of "Send my favorite products" button. A walk-through example would be:

A user browses a product catalog and "flags" several products to their favorites list. Since this product catalog is not an ecommerce solution, more or less a "view and contact us if you want to purchase something" type of site, they then send the products they have flagged to an administrator - with some type of "Send my favorite products" button.

I really appreciate any help. Thanks!

Comments

A suggestion, or two

itangalo's picture

If I were to implement the function described above, I would first ask myself if you really have to send a list to the administrator – or if she would be satisfied with a link to page where all the stuff is listed. If so, you have a much smaller task ahead:

  • Create a view that lists all the flagged stuff (for a selected user, say on user/%/favourites).
  • On the same page, have a button or extremely simple contact form that sends a link to the to the administrator.

If this is not enough, you'll have to do some more work – the most significant of it being a way to get the view information into a string that can be e-mailed. I would suggest the following:

  • A view user/%/favourites that lists all the flagged stuff for user %.
  • A custom PHP function favouritelist_get_list_formatted($uid) that loads the view above and returns its output in a format that can be included in an email (which probably means stripping HTML and making a very simple bullet list). You'll probably want to have a separate views display to make this easier.
  • A button on user/%/favourites that triggers a rule with a 'send e-mail to user' action. In the message you include favouritelist_get_list_formatted($uid).

If you want to make the solution more clean you stuff the view and the custom PHP function in a module.

You might have some use of the Button Field module to trigger the rule (but my experiences with that module are not only positive).

Good luck!
//Johan Falk, NodeOne, Sweden

Itangalo, I can't thank you

yellowhousedesign's picture

Itangalo,
I can't thank you enough for your suggestions - I think the contact form route is a MUCH simpler route, so I may try to explore that. Thank you again for your help!

The WebForm approach actually

yellowhousedesign's picture

The WebForm approach actually works great! I guess I never thought about just placing a WebForm block on that page. The only issue I ran into is that since it would only send a link to the administrator - if a user deleted their bookmarked content after submission - it would leave us at square one. The MUCH harder approach you talked about sounds like a better option, so I'll have to see if I can find some documentation on creating that custom PHP function - or any guidance. Thanks!

more info on form submission

ajsam1234's picture

I have similar requirement and I just learned how to let user create its own list of flagged items (list of any content items)

Now user wants to send this list to someone for review.. This must be a common requirement. I am surprised there are not many projects outside that need this requirement.

The second option provided by Falk seems to be interesting..but since I am new to Drupal would you be able to give me any leads on this?

Thanks

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: