Tell us what you are trying to do?
I'm trying to add a notification to an email address of one of my custom field
I'm working on a website similar to a real estate example.
The owner can add a lot of structures and fill a lot of fields. One of these fields is the email of the structure's owner.
I create a relationship between Messages and structures and on each structure page, I published a form for users who want to ask for some information about the structure.
I need
1 ) the email shows the name of the structure.
2) the form is sent to the email of the structure's owner.
1) Post name issue: I tried to use %%POST_TITLE%% [wpv-post-title output="sanitize"] [wpv-post-title] but I see CRED Auto Draft 48ac6a82a1595204666869437f1cec6f
2) Notification issue: I add this code to the toolset custom code page.
function modify_recipients($recipients, $notification, $form_id, $post_id) {
// Check notification name matches target notification
if ( isset($notification['name']) && 'owner-notification' == $notification['name'] ) {
// Add email recipient
$parent_id = toolset_get_parent_post_by_type( $post_id, 'struttura' );
//$parent_id = toolset_get_related_post( $post_id,'struttura-messaggio');
$email_of_owner = get_post_meta($parent_id, 'e-mail-struttura', true);
$recipients[] = array(
'to' => 'cc',
'address' => $email_of_owner,
'name' => '',
'lastname' => ''
);
}
return $recipients;
}
As you can see I tried both 'toolset_get_parent_post_by_type' and 'toolset_get_related_post' but notification isn't sent.
What is wrong with my code? Could you help me, please?
Thank you so much.
Is there any documentation that you are following?
yes https://toolset.com/forums/topic/cred-notification-to-email-from-parent-post-field-no-longer-working-after-types-3-0-update/
Is there a similar example that we can see?
yes
What is the link to your site?
hidden link