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.

Send Email Notification Using Custom Field

  1. sbruner
    Member

    My website has 20 authors, and each one has their own bio page. Currently this is an actual WP "Page" not the author page WP creates. I want to include a contact form at the bottom of each bio page, with the email notification going to that specific author.

    I would love to use ONE form for ALL the author pages.

    Currently I have the author email as a custom field that autopopulates in the form. I thought of hiding this field, and setting the notification to this field, but the notification only take email addresses, not field values.

    Anything you can recommend would be appreciated.

    Example url: http://dev.commentarymagazine.com/bloggers/boot/

    Posted 14 years ago on Monday November 29, 2010 | Permalink
  2. This is possible. See this post that discusses how to send the form notification to the author of a post. This is similar to what you want to do.

    http://forum.gravityhelp.com/topic/sending-form-to-author-of-post

    Posted 14 years ago on Monday November 29, 2010 | Permalink
  3. sbruner
    Member

    That post really helped... thanks.

    To further document how I accomplished this:

    PLACE IN FUNCTIONS.PHP

    add_filter( 'gform_notification_email_7', 'route_notification', 10, 2 );
    function route_notification($email_to, $entry) {
    	global $post;
    	$email_to = get_post_meta($post->ID, 'CUSTOM FIELD KEY', true);
    	return $email_to;
    }

    The "7" in 'gform_notification_email_7' is the form ID.

    IN THE FORM:
    -Check "Enable email notification to administrators"
    -Under "Send to Email", check "Email"
    -Make sure you enter an email address. This email can be anything. Since you're going to be filtering it with the code, above, it doesn't really matter.
    -Save settings.

    That's it!

    Posted 14 years ago on Tuesday November 30, 2010 | Permalink