Use Gravity Forms to send a email to the vendor of the currently viewed listing

Hello Hivepress,

I’m trying to use Gravity Forms to send a email to the author of the currently viewed Hivepress listing author.

I have this code:

// Dynamicly add post author to Gravity Forms //
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;
}

But it doesn’t seem to work. How does Hivepress stores the user of a post? I can’t find a custom field where the user/email of a listing is stored.

Thank you,
Menno

Please try to change email on user_email in get_the_author_meta

Hello Yevhen,

For some reason the ‘to’ value is not correct. Does Hivepress adds a post author to a post?

// Dynamicly add post author to Gravity Forms //
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( 'user_email', $post->post_author );
 
return $author_email;
}



Oh i think the name parameter in the advanced settings needs to be author_email instead of value_author_email :slight_smile:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.