Skip Navigation

[Resolved] Integrating a Form that will submit users contact info to specific Supplier

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 18 replies, has 2 voices.

Last updated by jamesS-14 5 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1229275

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. ?

#1229622

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

#1229812

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.

#1229813

My issue is resolved now. Thank you!