We have a fitness site which uses the WP Amelia plugin to book courses.
This plugin store booking information in a table "wpaa_amelia_users"
ID
First Name
Last Name
Email
and of course, all the booking relationships.
We use a CRM built around a Toolset CPT "Customers" with custom fields to store additional information.
Through a Cred form, that reads the customer id stored in the Amelia table, it create new entries in the CPT "Customers".
ID
Amelia ID
First Name
Last Name
Email
Phone
Address
.....
.....
Is it possible to "hard-sync" the First Name, Last Name and Email of the Amelia "wpaa_amelia_users" table to the Toolset CPT?
So that when users change their email address in the Amelia table it will be automatically updated also in the relative Toolset custom field (or the other way around)?
I can query
SELECT firstName FROM wpaa_amelia_users WHERE id=toolset_customer_id
but I don't really understand how to save this information in the "Customers" CPT.
Hello. Thank you for contacting the Toolset support.
The thing is that Toolset stores the custom field value as per the WordPress standard to the postmeta table. So, any custom field value if you want to get/update you need to query the postmeta table.
You said: Is it possible to "hard-sync" the First Name, Last Name and Email of the Amelia "wpaa_amelia_users" table to the Toolset CPT?
So that when users change their email address in the Amelia table it will be automatically updated also in the relative Toolset custom field (or the other way around)?
==> https://toolset.com/contractors/
As per your requirement the action should be fired when you update the value within the Amelia table and as you know Amelia table is not Toolset property.
This is a pure custom programming case that is beyond the scope of Toolset support policy. If you require custom programming for your project, please feel free to contact our certified partners:
=>
Let's say I would prefill the Cred form field before submission, can I do that using the API instead of shortcodes?
I have this function, which read a user name from a table in a variable, but I still don't understand how do I set this value to the the form field.
add_filter('cred_filter_field_before_add_to_form', 'prefill_prima_scheda_cliente', 10, 1);
function prefill_prima_scheda_cliente($id){
if ($form_data['id']==8833)
{
global $wpdb;
$table_name = "wpaa_amelia_users";
$cid = $post->post_author;
$username = $wpdb->get_var("SELECT firstName FROM " . $table_name . " WHERE externalId=" . $cid);
$field['wpcf-nome'] = $username; //HERE is where I don't understand how to set the form field "Name" using the variable $name
}
}
Can you please share access details and problem URL where you added the form. I hope when you are displaying the form with that page you are passing the customerID as URL param.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
But can you please share access details so that I can adjust your code and please share the problem URL where you added the form.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.