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.

One form, 150 addressees

  1. Each of my blog posts is about a specific dancer. I want the reader to be able to click on a link in the blog post, and send an email to that dancer. I don't want to have to create a form for every single one of the 150 dancers!

    One solution was suggested but it involves having a dropdown box with all the dancers' names - not very practical with 150 names.

    The dancers are not users on the site - I'm the author of all the posts.

    Is there a shortcode I can put on each post which will use the same form but specify a different email destination in each post?

    Posted 8 years ago on Wednesday March 14, 2012 | Permalink
  2. Nope. There's no shortcode to do what you're asking. The notification routing is tied to a selection in a drop down or radio list.

    I'll inquire with the team about this scenario and see if there's something we can offer besides the normal routing options.. not sure offhand.

    Posted 8 years ago on Wednesday March 14, 2012 | Permalink
  3. Would there be a way to put the dancer's email address in to the post as a custom post field, and then have the form pull that in as a default? Probably could do that with a change to the theme templates.

    Posted 8 years ago on Thursday March 15, 2012 | Permalink
  4. momofone

    I have a similar scenario to the OP. I have events pages set up with the event title on each events custom post but the same standard registration form on each event page. It needs to route to the person in the area hosting the event which is included in the posts title.

    I can set up a hidden form field populated with the unique event title, however I can't route it to anyone as it is not chosen from a dropdown or radio button. Is there any way around this as there are likely to be hundreds of events and I don't want to create separate forms for each event? Whilst I could introduce a dropdown with 150 constantly changing venues, it is illogical considering the event is already in the title and the person is already on that event page.

    Posted 8 years ago on Sunday April 8, 2012 | Permalink
  5. dochara

    I was looking to do something similar, and came up with an answer that might be useful to someone.

    1. It assumes that the desired recipient email is a custom field on the post - example assumes this custom field is called 'recip_email'.

    2. When setting up the form add a hidden field, populated with the variable {embed_post:ID} - example assumes this is FieldID 5 in form 10.

    3. Add a recipient email field, set visibility to admin only. Example assume this is Field ID 7

    4. Enable notification to users, select the recipient email address as the to address.

    5. Add this function

    add_action("gform_pre_submission_10", "get_the_recipient_email");
    function get_the_recipient_email($form){
    $recip_mail=get_post_meta($_POST["input_5"],'recip_email', true);
    	$_POST["input_7"] = $recip_mail;

    Because you are doing this post submission the recipient email is not visible in the source at the time the form is submitted, but is added before the email is sent.

    Added - in fact you could do this by entering a custom field value as a variable in the recipient email field directly. I actually did something else - which was to get the post author email, which was not stored as a custom field. That looked like this:

    add_action("gform_pre_submission_10", "get_the_business_recipient");
    function get_the_business_recipient($form){
    $post_id = get_post($_POST["input_5"]);
    	$_POST["input_7"] = $author->user_email;
    Posted 8 years ago on Monday May 28, 2012 | Permalink
  6. There is an easier way of doing this. I use it on several of my websites. Here is Step by Step instructions -

    Posted 8 years ago on Monday May 28, 2012 | Permalink