Skip Navigation

[Resolved] toolset_connect_posts doesnt' connect proper posts

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.

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)

This topic contains 28 replies, has 3 voices.

Last updated by cassianS 1 year, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2538693

Minesh
Supporter

Languages: English (English )

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

I simply have access issues and currently I do not able to access the wp-admin as well

I've asked Waqar to check on this ticket and he will check the things and he will get back to you with his findings by Monday and continue with this ticket.

#2538719

Hi Minesh.
I don't know what to say. I thought I checked everything that could possible prevent your access... 🙁
Maybe you could share your IPs and I would allowlist them additionally everywhere I can?

#2540489

Hi,

Just wanted to update you that the provided website's admin access and FTP access details are now working for me.

I'll be performing some tests on my website with a similar code and setup and will share the findings, as soon as I can.

Thank you for your patience.

regards,
Waqar

#2540749

Hi Waqar, thank you!

#2546941

Hi team. I just want to check if you had a chance to test and find the issue.
Thank you for help

#2547613

Thank you for waiting as this troubleshooting turned out to be more complicated than initially expected.

I'll continue the testing and will share the detailed findings, by the end of the day today.

Thank you for your patience.

#2548825

Thank you for waiting, as I continued the testing on my test website and on your staging one.

In my tests the code that was earlier added on the website and was later removed works, as expected to connect the 3 related posts.
( in the relationships 'health-organization-and-report-request', 'doctor-and-report-request', & 'report-request-report-order-estimation' for both forms: "Report order with payment for HO" & "Report order without payment for HO" )

I wanted to confirm if the adding of new posts and new post-relationships within the same function can result in any failed results, due to submissions made in quick successions, but the forms and that custom code also passed those stress tests, in my test website.

You'll see the two new 'Report requests' posts created on the staging website and the custom code currently added at the bottom of the active theme's 'functions.php' file.
( note: the same code/function is also added in the snippet named 'toolset-custom-code' in Toolset's custom code section, but it is inactive )

Please continued to test the code and if you could find any case or steps where it fails, you're welcome to share the exact steps.

#2548903
Step4.jpg
Step3.jpg
Step2.jpg
Step1.jpg

Hi Waqar, thank you for checking the issue.
I checked it and made new tests and I can say that the issue remains the same.
I also see your newly created report requests. Please notice that both of them have connected the same referring dentist post. I would assume you chose a different dentist...(?)
And here is the issue that appears. If you make a new "Report request" and you chose a "referring dentist" (related doctor post), and you have more than 2 "dentists/doctors" to choose, most likely each time "report request" connects with one specific "doctor" even if you chose another one.

I made additional test and screenshots to show you this weird issue in steps.
Please check the attached images:
- Step1 screenshot. You can see that in Order form user as Health organization chose specific "doctor" Dr Frank.
- Step2. You can see that in result another "doctor" Dr Jim gets connected to created "report request".
- Step3. You can see that connected "doctor" Dr Jim has post ID = 917. but
- Step4. "doctor" Dr Jim shouldn't be connected as another post ID (ID of Dr Frank) was passed to "toolset_connect_posts", which you can see in the log file on this screenshot.

That's what makes me confused and that's where I need your help. I don't understand why this happening.
Please let me know what do you think

#2551035

Thank you for sharing these details and I understand now what you meant.

Toolset's relationship feature uses relationship IDs in the database, to store relationship information and not just rely on the respective post IDs. If for some reason those relationship IDs are not saved properly in the database, an issue like this can arise.

I'll recommend opening each 'Doctors' post type's edit screen and then disconnecting them from any existing post-relationships that they're in. After that, you can permanently delete these posts and then add some new 'Doctors' posts.

In case the issue with the incorrect post relationship still persists, I'll need your permission to download a clone/snapshot of this website, to perform deeper database-level testing on a different server.

#2551063

Hi Waqar, thank you for your reply.
I will do what you have recommended and come back to you with results

#2551903

Hi Waqar.
I did what you advised: I disconnected posts and removed them. I also run repair database tools just in case (they didn't show any issue btw).
Please use my permission to download a clone/snapshot of this website if you need it for more tests

#2553701

Hi Waqar. I just would like to clarify that all actions you've advised I tried and the issue remains the same. They didn't help.

#2554347

Thank you for waiting as I performed some deeper troubleshooting on your website's clone.

I can confirm that the function that you originally had was correct.
( available in this forum reply: https://toolset.com/forums/topic/toolset_connect_posts-doesnt-connect-proper-posts/#post-2535727 )

The reason it is not working as expected for the forms 'Report order without payment for HO' and 'Report order with payment for HO' is that they also include the code for the relationship fields:

1). Form: 'Report order without payment for HO'


	<div class="form-group hide-others">
		<label for="%%FORM_ID%%_@doctor-and-report-request.parent">[cred_i18n name='@doctor-and-report-request.parent-label']Doctor related to the order[/cred_i18n]</label>
		[cred_field field='@doctor-and-report-request.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' value='[current_user_doctor_post_id]']
	</div>
	<div class="form-group hide-others">
		<label for="%%FORM_ID%%_@health-organization-and-report-request.parent">[cred_i18n name='@health-organization-and-report-request.parent-label']Health organizations related to the order[/cred_i18n]</label>
		[cred_field field='@health-organization-and-report-request.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' value='[current_user_health_organization_post_id]']
	</div>

2). Form: 'Report order with payment for HO'


	<div class="form-group hide-this-field">
		<label for="%%FORM_ID%%_@doctor-and-report-request.parent">[cred_i18n name='@doctor-and-report-request.parent-label']Doctor related to the order[/cred_i18n]</label>
		[cred_field field='@doctor-and-report-request.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' value='[current_user_doctor_post_id]']
	</div>
	<div class="form-group hide-this-field">
		<label for="%%FORM_ID%%_@health-organization-and-report-request.parent">[cred_i18n name='@health-organization-and-report-request.parent-label']Health organizations lated to the order[/cred_i18n]</label>
		[cred_field field='@health-organization-and-report-request.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' value='[current_user_health_organization_post_id]']
	</div>

When your custom function is already handling the relationships programmatically, the inclusion of this code for these relationship fields results in this conflict.

Please remove the code for the fields mentioned above and then check that custom function again and it will work correctly.

#2554485

My issue is resolved now. Thank you!
Indeed, as soon as I removed hidden relationship fields in the form I don't see this issue anymore