This is what I did:
add_filter( 'gform_notification_email_2', 'route_notification', 10, 2 );
function route_notification($email_to, $entry) {
global $post;
$email_to = get_the_author_email();
return $email_to;
}
The 2 in gform_notification_email_2
represents the form ID. So you need to adjust this in order to filter the right form.
To pre-populate the Subject field, add this:
add_filter('gform_field_value_reactionsubject', 'populate_reactionsubject');
function populate_reactionsubject() {
global $post;
return 'Reaction to ' . $post->post_title;
}
To pre-populate the email field:
add_filter( 'gform_field_value_email_2', 'populate_email' );
function populate_email(){
if ( is_user_logged_in() ) {
global $userdata;
return $userdata->user_email;
}
}
Posted 14 years ago on Saturday December 26, 2009 |
Permalink