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.

Dynamic email notification using post authors email

  1. Hi guys,

    Im creating a job site where people can freely post jobs using one gravity form without registering.
    Then im creating a second form for job applications that will be embedded into each job post. However im trying to figure out how to send any job applications to the email of whoever posted that particular job. I also want a copy sent to the admin. How can I do this please?

    thanks
    john

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  2. David Peralty

    Do you have the e-mail of whomever posted the job? Where is it stored? Gravity Forms allows you to pre-populate fields, so you could have a field called Job E-mail that is an e-mail field type.

    Then using gform_pre_render, you would grab the e-mail address from where it is stored (custom field?) and place it in that Job E-mail field. You could even hide the Job E-mail field with CSS (add a class of .hidden and then add .hidden {display: none;} to your style.css).

    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    Then in Gravity Forms notifications, the TO address would be the Job E-mail merge tag, and you could put your e-mail in the BCC field.

    This would require some PHP coding to achieve.

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  3. Thanks David. Yeah I plan on creating an email field (hidden on job post) when they submit a job. So it will be grabbed from here. Much php required? I thought it would have been possible just using gravity forms hooks & pre-population or whatever? My php knowledge is very limited unfortunately!

    cheers
    john

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  4. David Peralty

    You would have to retrieve the custom field value and then push it into the hidden field. This will definitely require some low-intermediate PHP knowledge to accomplish. There are many developers out there that could probably do this for you in an hour or less.

    Gravity Forms can do pre-population, but you still need to retrieve the e-mail address to pre-populate a form field. If you can figure out in PHP how to grab values from Custom Fields so you can get the e-mail address the of the job creator, then you can easily get the rest going using our tutorials in our documentation.

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  5. Thanks David.

    If anyone would like to give me a php solution to do this, im all ears! :)

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  6. David Peralty

    So, if the form to create the job has an e-mail field, and you put that value into a custom field called jobemail, then on your resume submission form, something like this would potentially work. (I haven't tested it.)

    <?php
    
    add_filter("gform_field_value_jobemail", "grabjobemail");
    function grabjobemail($value){
            global $post;
    	if (get_post_meta($post->ID, 'jobemail', true)) {
        	$jobemail = get_post_meta($post->ID, 'jobemail', true);
    		return $jobemail;
      	}
    
    }
    
    ?>

    Basically, this would go in your functions.php file. You would need a field in your resume submission form called Job E-mail with allow populate dynamically checked and the parameter name to be jobemail.

    http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name

    This should grab the value of the custom field and push it into the form field.

    Posted 11 years ago on Thursday August 2, 2012 | Permalink
  7. Thanks David,ill try that!
    john

    Posted 11 years ago on Wednesday August 15, 2012 | Permalink