Skip Navigation

[Resolved] Change the connection between 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
- 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 1 reply, has 2 voices.

Last updated by Minesh 5 months, 2 weeks ago.

Assisted by: Minesh.

Author
Posts
#2701205

Dear Sir/Madam,

I have a relationship with the applicant and booking, and I have already assigned the relationship is 1-n for 1 application can only has 1 booking but 1 booking can have many applicant

I try to do

$connection = toolset_connect_posts('booking-applicant', $booking_id, $applicant_id); 
print_r($connection);

but I get below message

Array
(
    [success] => 
    [message] => The element A24 has already the maximum allowed amount of associations (1) as  in the relationship Bookings Applications.
)

I know I have to disconnect and then connect to the new one, I worry if there is another connection request while I disconnect it and then connect to the.new one, then I lost the existing one and can't make the new connection, how can I avoid this happen?

Best regards,

Kelvin.

#2701227

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I'm not sure yet but I dont know your post relationship structure.

If you want to have "one booking can have many applicant" so what if you create one to many post relationship between booking (one) and applicant (many) post type.

You can check if post has already connection. Please check the following related ticket:
- https://toolset.com/forums/topic/conditional-check-if-there-are-related-posts/#post-1234376