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.

Email post author

  1. Shunarjuna
    Member

    I'm sorry for being such a spaz, I know this question has come up a number of times but I just can't figure out what I am doing wrong.

    I followed the steps in this tutorial; http://www.gravityhelp.com/documentation/page/Dynamically_Populating_the_Post_Author, pasting this code into my functions.php

    add_filter('gform_field_value_author_email', 'populate_post_author_email');
    function populate_post_author_email($value){
        global $post;
    
        $author_email = get_the_author_meta('email', $post->post_author);
    
        return $author_email;
    }

    I then created a form with an email field. Selected "Allow field to be populated dynamically", then put in this value: populate_post_author_email

    In the notifications section, under "Notification to User" I selected the email field in the "Send To Field"

    When I tested the form I noticed two things. First, the field I tried to dynamically populate was empty, second, only admin got notification of the email.

    Any help would be appreciated.
    Thanks.

    Website - http://www.teachmemusic.com.au
    Example form - http://www.teachmemusic.com.au/listings/test-search-2/

    Posted 12 years ago on Tuesday September 11, 2012 | Permalink
  2. Shunarjuna
    Member

    Never mind, I figured it out.
    I was putting the wrong thing in the "Allow field to be populated dynamically" field. Instead of putting populate_post_author_email, I was meant to put author_email.
    It's all working fine now. (Maybe a quick edit of the tutorial I is in order - It didn't actually say what is meant to go in the Allow field to be populated dynamically field. Just a suggestion)

    Posted 12 years ago on Tuesday September 11, 2012 | Permalink
  3. Thank you for the suggestion and update. Glad you were able to work it out.

    Posted 12 years ago on Wednesday September 12, 2012 | Permalink