PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

collecting email addresses

  1. I'd like to collect email addresses.

    I think I can figure out how to build a simple single-field form with GF.

    After I've collected addresses, how can a wordpress user then access the email addresses that I've collected, in the form of a list?

    Thanks

    Posted 12 years ago on Friday November 18, 2011 | Permalink
  2. Once the data is collected, what exactly are you going to do with the addresses? Do you want to display them on a protected page on your site?

    You can always export the entries and then use those email addresses locally however you want.

    Posted 12 years ago on Saturday November 19, 2011 | Permalink
  3. Yeah - that's the approach that makes sense to me at the moment: having the aggregated submissions published on a page that's only visible to site editors. And even simpler way would be to just publish the content to a page that is protected by a password.

    So, I guess I'd like pointers on how to grab and publish the content.

    Posted 12 years ago on Saturday November 19, 2011 | Permalink
  4. Gravity Forms is not designed to display data on the front end, but there are functions available to help you do it. Can you put a form online so we can see just what fields we're talking about? That way, we can give you a code example.

    I've written shortcodes in the past to pull data from Gravity Forms entries. But they are specific to the form and field. If we can see yours, we can help better.

    Here is some code I used in the past:
    http://pastebin.com/kHpaHQvi

    To use that, you insert a shortcode like this into a page:

    [php]
    [participants form=37]

    That will pull the entries from one specific field, for form 37. It also does some processing. Your code will be much simpler than this. You might only have one form, one field, and no processing.

    Posted 12 years ago on Saturday November 19, 2011 | Permalink
  5. Hi Chris.
    The form is on this page:
    http://74.52.51.90/about

    I'd like to extract the user-submitted emails.

    Posted 12 years ago on Thursday December 8, 2011 | Permalink
  6. I submitted that form and it did not appear to do anything? I don't see a Gravity Form on that page, so it will be difficult to provide you with an exact code example for your form and form fields.

    Basically though, you want to retrieve all the emails addresses submitted by this form and display them on a page on your website? This code will give you a shortcode [submitted_emails] and you can insert that into a page or post to return a list of all values for one field, from one form. Use it like this:

    [php]
    [submitted_emails form='FORMID']

    Where FORMID is your actual form ID. If you want the email addresses from form 2, the shortcode in your post will look like this:

    [php]
    [submitted_emails form='2']

    http://pastebin.com/FUF9HA6B

    You need to edit this code on line 7 to include the ID of the field you want to return values for. And when you use the shortcode, use the ID of the form you want values from. Let us know if you need more help with that.

    Posted 12 years ago on Saturday December 10, 2011 | Permalink
  7. Hi Chris.
    Thanks for the continued support.

    Apologies for giving the wrong link. I've got it set up on this page now:
    http://74.52.51.90/formtest

    I have this in the page template:

    <?php echo do_shortcode("[gravityform id=2]") ?>
    <?php echo do_shortcode("[submitted_emails form='2']") ?>

    I've pasted the code you've given me into my functions.php, having replaced the string 'CHANGE THIS TO YOUR EMAIL FIELD ID' with the form id. (which is '2').

    Perhaps I'm still doing something wrong. Instead of seeing the email address, I'm seeing the string 'Array'.

    Posted 12 years ago on Sunday December 11, 2011 | Permalink
  8. This "CHANGE THIS TO YOUR EMAIL FIELD ID" should be the field ID, not form ID. We are pulling all the values from this one FIELD, using the shortcode to specify the form ID.

    Looking at your new page, I suspect the "2" for the field ID needs to be "1". Try that and see if it works. If not, please export your form as XML and email it to chris@rocketegenius.com and I will take a look at it for you to be sure it works with the code I provided. I modified the code from what I used it for and it might have an error. Thanks.

    Posted 12 years ago on Sunday December 11, 2011 | Permalink