Tell us what you are trying to do?
- I am connecting two posts using toolset_connect_posts() in cred_save_data hook.
I was using toolset_connect_posts many time no problem but for some reason it doesn't connect proper posts.
in my case I have something like this:
add_action('cred_save_data', 'order_report,10,2);
function order_report($post_id, $form_data)
{
if ($form_data['id']==123 )
{
$report_post_id = $post_id;
$customer_post_id = $_POST['customer-post-id']; // customer post was previously created and its ID was selected in the form
if ( $customer_post_id) {
toolset_connect_posts( 'customer-report-connection', $customer_post_id , $report_post_id );
}
...
I see through "error_log($customer_post_id );" that post IDs are correct and created report post should be connected with correct customer post.
But after form submitted I check created post and it gets connected to the wrong customer post.
Hello. Thank you for contacting the Toolset support.
That is really strange.
Can you please share problem URL where you added the form as well as admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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.
I'm not sure but when I try to login using the access details shared in first private message it was working but suddenly after loggedin I could not able to access the site. Can you please make sure that the staging site is up and running.
Hi Minesh, sorry to hear you faced an issue again.
The only thing blocking you I would assume is a firewall. I disabled this plugin completly.
btw, its logs showed that you logged in successfully... weird.
anyway, could you please try one more time to log in?
Yes - I tried to login and I can login to admin but after sometime I'm not what is happening that I could not access the site.
I tried to login again and I can login now and site it working for now. Can you please send me working FTP access details as I could not able to connect to the server.
Also, I see you have added the following code to functions.php file - I will move it to "Custom code" section offered by Toolset:
// Rerport order creation customization: update order and create order estimation together with order.
// For HO form
add_action('cred_save_data', 'order_report_no_image_for_ho_customization',10,2);
function order_report_no_image_for_ho_customization($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==721 || $form_data['id']==848)
{
// get a generic field value from the $_POST superglobal under the slug key
$patient_first_name = $_POST['wpcf-patient-first-name'];
//error_log('patient_first_name: ' . $patient_first_name);
$patient_last_name = $_POST['wpcf-patient-last-name'];
$order_post_id = $post_id;
$order_post_date = get_the_date('Ymd', $order_post_id);
// setup connecion of doctor and HO with request/order post
$ho_name = $_POST['current-ho-post-id'];
error_log('HO name variable: ' . $ho_name);
error_log('post_id variable: ' . $post_id);
$referring_dentist_post_id = $_POST['referring-dentist-related-to-ho'];
// connect order and health organization posts
if ( $ho_name ) {
toolset_connect_posts( 'health-organization-and-report-request', $ho_name, $order_post_id );
}
// connect order and doctor posts
if ( $referring_dentist_post_id ) {
error_log('refering dentist post ID to connect: ' . $referring_dentist_post_id);
error_log('order post ID to connect: ' . $order_post_id);
toolset_connect_posts( 'doctor-and-report-request', $referring_dentist_post_id, $order_post_id );
}
// setup order estimate post and connection with order
$order_estimate_title = $patient_first_name . " " . $patient_last_name . " - " . $order_post_id . " - " . $order_post_date;
$report_post = array(
'ID' => $order_post_id,
'post_title' => $patient_first_name . " " . $patient_last_name . " - " . $order_post_id
);
wp_update_post( $report_post );
//error_log('user ID: ' . $user_id);
if ( $order_estimate_title ) {
// insert the new Report order estimate post
$report_order_args = array(
'post_title' => $order_estimate_title,
'post_type' => 'report-order-estim',
'post_status' => 'publish',
'post_author' => $post_id
);
$report_order_id = wp_insert_post($report_order_args);
// connect new order estimate post with order post
toolset_connect_posts( 'report-request-report-order-estimation', $order_post_id, $report_order_id);
}
}
}
I see you have two-three post relationship is used and you are trying to connect the post using function toolset_connect_posts() can you please tell me with what connections you have the issue with? or I'm looking at the wrong place?
Hi Minesh. Thank you for taking a look on this.
Could you please send me a secure form so I would update FTP access for you?
Regarding the connection issue: I have an issue with "doctor-and-report-request" connection.
Again - the FTP access details you shared is not working at this end. I've also checked with my collogue and for him as well the shared FTP access details is not working.
Can you please send me working FTP access details. Do I need to use any specific port number to connect?
I have set the next reply to private which means only you and I have access to it.