0

I create a simple ecard page where users can send some (stupid) ecard to other people.

Now for some reason our clients wants to save all these email addresses, and I'm wondering what the best way to do this is? Obviously I would also need to show a list in the admin.

I was thinking of just using some newsletter module, but for none I checked there is a function where I can add email addresses using coding.

Does anybody know a quick and simple solution? I have custom coded this page, so I'm looking for a module that allows me to add email addresses in php.

2
  • 1
    Is the form you are using a Drupal form? If so, how did you make it? A node form, webform or custom form? It sounds like Webform module can do the job.
    – AKS
    Commented Oct 9, 2012 at 15:36
  • It's not using a Drupal form, just a custom form in a custom template file.
    – woutr_be
    Commented Oct 10, 2012 at 2:06

3 Answers 3

2

You might as well do it right and use webform. It will literally take you minutes once you figure it out.

And then for the ecard submission, you could install the rules module and pass the form values as tokens (including the email address) telling rules that when a webform with the id of "supid_ecard" is submitted, fire this rule -- http://drupalcontrib.org/api/drupal/contributions!rules!rules.module/function/rules_invoke_event/7

All you'd need to do is setup a custom module with hook_rules_event_info() to tell Drupal about your rules, hook_token_list() to list out your tokens, and hook_token_values() so it knows how to render your tokens. Or use the tokens already available.

0

You could try and create a new content type and call it something like stupid_ecard, Then you would create a module and use Hook_node_insert to get all the data from your form and insert it in your node.

Then you could create a view that would get the email field "or any other fields" from your content type and show it in a list.

0

Thanks for all the advice, it might not be the prettiest solution, but I ended up using the Watchdog to log the emails. I then used Watchdog Views to create a page with just these specific actions, as Watchdog is used for logging I figured I could just log every person who sends an ecard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.