Email/subscriber validation issues with subscriber_lists extension

Hey guys,

I am using the subscriber lists extension (thanks nelstrom, I love the
CSV
export) for creating a “contact us” type of form. The problem is that
when
somebody signs up with an email address that is already in the db, the
information gets overwritten with the newly submitted data. I am not
exactly
sure how to add a check against the db to find out if an email address
is
already there, and then return an error message that tells the user so.
Can
anybody give me some pointers on how to add that into the form process
action?

Pastie with the action from the subscriber_list_page model:
http://pastie.org/288758

Mucho, mucho garcias.

~Nate

On 9 Oct 2008, at 18:24, Nate T. wrote:

Hey guys,

I am using the subscriber lists extension (thanks nelstrom, I love
the CSV
export) for creating a “contact us” type of form.

I’m not sure if I understand you correctly, but “Contact us” is not
the use case I had in mind when I made the subscriber lists extension.
It is more appropriate for a “Sign up to our mailing list” type of
scenario. (Such as demonstrated here: http://westportbookfestival.org/)

If you want a “Contact us” form, I think the Mailer extension could be
a better fit.

GitHub - radiant/radiant-mailer-extension: An extension for Radiant CMS that allows you to create 'contact us' and other mail-bound forms.

I’ll answer the rest of your mail assuming that a “Sign up to our
mailing list” scenario is what you actually want…

The subscriber_list extension does not handle sending mail from the
server, so there is no verification step. (e.g. sending an email to
the submitted address, with an activation link.) If you need that
functionality, try out Andrea’s newsletter extension:

GitHub - gravityblast/radiant-newsletter: Newsletter system based on Radiant CMS

The subscriber list extension is basically a plagiarized newsletter
extension, with the mailing functionality removed. I couldn’t get the
newsletter extension to send mail through a gmail account. Although I
would be willing to try again since I discovered this:

http://github.com/caritos/action_mailer_tls/tree/master

The problem is that when somebody signs up with an email address
that is already in the db, the information gets overwritten with the
newly submitted data.

If an email is submitted to the form, it is added to the list
immediately. Without verifying that the email address submitted
belongs to the person who submitted it,

Without a verification step, the case of one email being submitted
more than once is difficult. You could either:

  • Add all details to the db each time they are submitted, regardless
    of whether they have been submitted before or not (potentially leading
    to duplicates)
  • Check if an email has been added already, and ignore any form
    submissions if the email address supplied is already in the db
  • Check if an email is already in the db, and if it is, use the
    details supplied in the form to update the details of the entry
    already existing

I settled for the last of these, although none of them are really
satisfactory, because you don’t know (without a verification step)
whether the person submitting the form is the true owner of the email
address.

Verification is clearly the best-practice, but as an extra step in the
procedure, it can be seen as a deterent. And so clients often prefer
to have a simple one-step signup, despite the problems it can cause.

I am not exactly sure how to add a check against the db to find out
if an email address is
already there,

It already does this (line 9 in your pastie):

@subscriber =
Subscriber.find_by_email_and_subscriber_list_id(parameters[:email],
self.id)

Here is the relevant section of code, annotated with comments:

http://pastie.org/289009

That should help you out, if you want to modify the behaviour.

Cheers,
Drew