ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Making a really simple petition

April 09, 2008 3:18am

Subscribe [5]
  • #1 / Apr 09, 2008 3:18am

    moresided

    18 posts

    Hello

    I need to build a simple petition. Can you help?

    Users should enter the following details:

    *Name
    *Location
    *Email
    *Opt-in to further communication yes/no

    Then the system should send them an email. In that email they should have a link to click that can confirm their email, and add their name to the petition, which will be displayed on another page. We’d like to be able to email all people who’ve opted in.

    That’s basically it. The reason I’m asking here is that having searched these forums, there seem to be a few options, none of which are ideal:

    Using comments
    Not sure how to get the email confirmation working for this. Plus I don’t want people to be able to add themselves twice.

    Using member registration
    The templates for the member area seem like a nightmare to restyle, and people who sign the petition don’t need all the complex member functionality.

    Solspace User Module
    Seems like it might be the easiest, but I’d rather not pay $90 if I don’t have to.


    Does anyone have a better idea? Or an example of what they’ve done?
    Help would be greatly appreciated.

  • #2 / Apr 09, 2008 11:52am

    Greg Aker

    6022 posts

    Moresided,

    Sounds to me like a perfect job for the Solspace Freeform Module.

    You setup the information you want to collect in your control panel, it collects it, emails you and the user (if you wish), stores the response in the database and you can sign them up for the mailing list.

    You can even display the results on your site if you wish.  It’s a very handy module that I have found many different uses for.

    Good luck,

    -greg

  • #3 / Apr 09, 2008 11:54am

    Ingmar

    29245 posts

    I second that. It’s free, too 😊

  • #4 / Apr 10, 2008 3:37am

    moresided

    18 posts

    Ok thanks! Going to try it out.

  • #5 / Apr 10, 2008 2:12pm

    asozzi

    262 posts

    Not to dissuade you from using EE. But sometimes other solution are just simpler. Have a look at online form builder solutions e.g. wufoo.com

    Most of them are free up to a point and can be integrated into your page.

  • #6 / Apr 16, 2008 1:06pm

    moresided

    18 posts

    Thanks for the help guys. It’s up now:
    http://www.stopclusterbombs.ie/

  • #7 / Apr 16, 2008 1:09pm

    Greg Aker

    6022 posts

    I’m glad it worked for you.

    Your design on that site is killin’!  Nice work!

    -greg

    Thanks for the help guys. It’s up now:
    http://www.stopclusterbombs.ie/

  • #8 / Apr 19, 2008 3:26am

    moresided

    18 posts

    Thanks!

    I thought I should note down briefly how I did the petition so that others can follow along if they need to. The main issue is that the mailing list does not store any other fields apart from IP and email address - but I did want people to have to confirm their email in order to appear on the list. So I had to combine the mailing list with Freeform to store and retrieve other data, like name, country etc for each entry - which I wanted to show on the list.

    1. Download Solspace’s Freeform module and install.
    2. Create a mailing list - I called mine ‘petition’
    3. Create a template for your petition form, and use something like this for the freeform start tag:

    {exp:freeform:form form_name="petition" return="petition/thanks" required="first_name|last_name|email" prevent_duplicate_on="email" mailinglist="petition" mailinglist_opt_in="yes"}

    The idea is that users who enter their details automatically receive an email asking them to confirm - this is sent by the mailing list module. When they click the link in the email they get added to the mailing list. Their details like name, country etc are saved into the freeform module.

    4. To display a list only of people who have confirmed their email address, use an SQL query to match Freeform entries to people who have confirmed their email and as such been added to the mailing list:

    {exp:query sql="SELECT exp_freeform_entries.first_name as 'first_name',exp_freeform_entries.last_name as 'last_name',exp_freeform_entries.country as 'country',exp_freeform_entries.entry_date as 'entry_date',exp_freeform_entries.entry_id as 'entry_id' FROM exp_freeform_entries, exp_mailing_list WHERE exp_freeform_entries.email = exp_mailing_list.email ORDER BY exp_freeform_entries.entry_id DESC"}

    As you can see, only entries which match email to email will be shown.

    5. As an extra touch, use a PHP counter to show the number of each person who has signed the petition:

    <?php $total_results = {total_results}+1;
    $count = {count};?>

    And then on each row:
    <?php echo ($total_results - $count); ?>

    I think that’s it. Well it seems to work anyway 😊

  • #9 / Apr 19, 2008 10:27am

    Chris Malumphy

    16 posts

    moresided,

    That’s a great explanation. You should consider adding it to the wiki!!!

  • #10 / Apr 19, 2008 12:16pm

    moresided

    18 posts

    OK I’ve added it now.
    http://expressionengine.com/wiki/A_simple_petition/
    May ye all create petitions aplenty.

  • #11 / Nov 20, 2008 8:48am

    John Ryan

    51 posts

    Brilliant, that’s really helpful. Thanks for posting that, moresided.  😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases