Skip Navigation

[Resolved] Get new and previous value before save data for many to many relationships

This support ticket is created 2 years, 11 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by igorL-3 2 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#2033117

Tell us what you are trying to do? I want to be able to get new values from a may-to-may submission form before it is stored. This is similar to the example I quoted below. I can get the new values of the custom fields and one-to-many relationships from $_POST and the old values for custom fields from get_post_meta(). The old value for the related posts from toolset_get_related_post() for both one-to-many and many-to-many but how to I get the values submitted on the many-to-may forms before they are saved in the database.

Is there any documentation that you are following? https://toolset.com/forums/topic/get-new-and-previous-value-before-save-data/

Is there a similar example that we can see? https://toolset.com/forums/topic/get-new-and-previous-value-before-save-data/

What is the link to your site?

#2033287

Hello, there is no API available for post relationship Forms, so hooks like cred_before_save_data, cred_save_data, and cred_submit_complete do not apply in the case of many-to-many Forms. I'm not sure of a good way to get the IDs of related posts before they are connected in the database because there is no true API for relationship Forms. The post relationships APIs toolset_association_created and toolset_before_association_delete can help you inspect the related post IDs, both before an existing relationship is deleted from the database and also immediately after an association has been created and stored in the database, so you may be able to work with these APIs to achieve something similar. Post Relationships API documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_association_created
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_before_association_delete

#2035513

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.