Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Great glad to know that.
Now, I've added the following code to the "Custom Code" section offered by Toolset:
=> hidden link
/* connect application to supplier */
add_action('cred_save_data','func_connect_child_post_with_supplier',15,2);
function func_connect_child_post_with_supplier($post_id,$form_data) {
if ($form_data['id']==1479) {
toolset_connect_posts('supplier-application',$_POST['supplier_id'], $post_id);
}
}
/* send notification to supplier email */
add_filter('cred_notification_recipients', 'modify_recipients', 10, 4);
function modify_recipients($recipients, $notification, $form_id, $post_id) {
$supplier_id = $_POST['supplier_id'];
$sup_email = get_post_meta($supplier_id,'wpcf-supplier-email',true);
if ( isset($notification['name']) && 'email-to-supplier' == $notification['name'] ) {
// Add a BCC to log@emailaddress.com<br>
$recipients[] = array(
'to' => 'to',
'address' => $sup_email,
'name' => '',
'lastname' => ''
);
}
return $recipients;
}
More info:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients
Then, I also changed the [wpv-post-title] shortcode added to message and email notification as given under - because we need to display the parent (supplier) infomation (title):
[wpv-post-title item="@supplier-application.parent"]
I've also added the hidden generic field to your form just before the submit button that holds the current supplier Id:
[cred_generic_field type='hidden' field='supplier_id']
{
"default":"[wpv-post-id]"
}
[/cred_generic_field]
I can see everything is working fine. Can you please confirm. ?
Yep it works great. Nice work!
However, right now when a user submits the form, the Supplier will get a notification coming from my admin email address. Is there a way to set it up where it would come from the user's email instead? That way the Supplier can just reply back to the email they received. Because right now, if the Supplier were to click "reply", their response would come to my admin email instead of to the actual users email. Is there a way to set it up that way by any chance?
Thanks,
James
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Glad to know that your original issue is resolved and the solution I shared help you to resolve your issue where we setup the form for the supplier with email and connect the applications to suppliers.
Please kindly open a new ticket with your every new question. This will help other users searching on the forum and help us to write correct problem resolution summery for which ticket originally submitted.
My issue is resolved now. Thank you!