Update: I used the first part of the Formidable Forms code to add a tab and form to the listing details page. This works 🙂
I’ve added some code as a snippet to try to send the email to the listing owner when the form is submitted. It works if, as a test, I put in any old email address:
add_filter( ‘caldera_forms_mailer’, function( $mail, $data, $form ) {
if( ‘CF5ad9d7’ == $form[ ‘ID’ ] ) {
$mail[ ‘recipients’ ][] = ‘[email protected]’;
}
return $mail;
}, 10, 3 );
However when I try to obtain the listing owner’s email, it doesn’t work:
add_filter( ‘caldera_forms_mailer’, function( $mail, $data, $form ) {
if( ‘CF5ad9d7’ == $form[ ‘ID’ ] ) {
$post_id = (isset($_POST[‘gd_place_id’]) && $_POST[‘gd_place_id’]) ? absint($_POST[‘gd_place_id’]) : ”;
if ($post_id) {
$place_email = geodir_get_post_meta($post_id, ‘geodir_email’);
}
if ($place_email) {
$mail[ ‘recipients’ ][] = $place_email;
}
}
return $mail;
}, 10, 3 );
Any help would be much appreciated 🙂