Skip Navigation

[Gelöst] toolset_connect_posts doesnt' connect proper posts

This support ticket is created vor 1 Jahr, 11 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

Dieses Thema enthält 28 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von cassianS vor 1 Jahr, 9 Monaten.

Assistiert von: Waqar.

Author
Artikel
#2528751

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.

Documentation I use:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

What is the link to your site?
versteckter Link

#2530033

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

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.

#2530955

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Could you please tell me where on what page/post you added the form?

#2531319

yep, sure
versteckter Link (second form)
and
versteckter Link (second form)

#2531647

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Do I require to loggedin as frontend user as I see that the generic field you added "current-ho-post-id" has the value "no posts to display".

<input type="hidden" id="cred_form_721_1_1_current-ho-post-id" name="current-ho-post-id" value="no posts to display" class="wpt-form-hidden form-hidden" data-wpt-id="cred_form_721_1_1_cred_form_721_1_1_current-ho-post-id" data-wpt-name="current-ho-post-id" />   

Can you please share with what frontend user I've to login?

I have set the next reply to private which means only you and I have access to it.

#2532771

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

When I try to access the wp-admin or login using the user account you shared with the last reply - it shows me the following message:

Your access to this site has been limited by the site owner

I do not have find any way to add authorization access details. Can you please unblock it so I can access the admin.

#2533047

Sorry, could you please use credentials from the first private message? I also just in case disabled the firewall to avoid blocking you.

#2533579

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

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.

#2533751

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?

#2535645

Hi! I am wondering whether you had a chance to login and check the issue?

#2535727

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

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?

#2535783

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.

#2535957

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

*** Please make a FULL BACKUP of your database and website.***
I have set the next reply to private which means only you and I have access to it.

#2537043

Hi,

Thank you for sharing these access details.

Just wanted to update you that Minesh is on vacation. He will be able to follow up on this when he gets back tomorrow.

Thank you for your patience.

regards,
Waqar

#2537885

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

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.