Skip Navigation

[Resolved] Providers and documents expiration date

This support ticket is created 4 years, 6 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.

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 2 replies, has 2 voices.

Last updated by DavidZ1525 4 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1584539

Tell us what you are trying to do
Hi, I am creating a custom type which is "provider" and another custom type "document". They relation is one to many, since providers can have multiple documents. There are different types of documents and need to keep a expiration date to control whichones are about to expire. Document is basically an attached filed.
My questions are:
1. how do I programatically (via api) create a provider and attach different documents to it? Any documentation to follow here?
2. How do I create a view in which the documents with expiration date are "red", and even notify via email?

Is there any documentation that you are following?
Yes, views and wp API documentation.

Is there a similar example that we can see?
Description should be enough.

What is the link to your site?
luxflow.in. Nothing public yet.

Thanks!

#1584891

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

It seems that you want to establish a relationship between two posts using the PHP API.

1. how do I programatically (via api) create a provider and attach different documents to it? Any documentation to follow here?
===>
Having said that, basically you want to connect the posts to implement a relationship between two posts. If this is correct - you can use the post-relationship API function toolset_connect_posts():
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

To fetch related posts, you can use the post-relationship API function: toolset_get_related_posts()
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

If you want to use the WP_Query, you can check the following Doc:
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/

2. How do I create a view in which the documents with expiration date are "red", and even notify via email?
===>
Actually, post-exiration is feature belongs to Toolset forms:
- https://toolset.com/documentation/user-guides/front-end-forms/automatic-post-expiration/

Where you can set action to update any custom field value when the post expiration is triggered:
- https://toolset.com/documentation/user-guides/front-end-forms/automatic-post-expiration/#what-happens-when-posts-expire

Even you can set email notification when the post is expired;
- https://toolset.com/documentation/user-guides/front-end-forms/automatic-post-expiration/#sending-email-notifications-when-posts-expire

As I understand:
- you want to list ONLY expired posts using view?
- is post-expiration settings are already set or posts are created using Toolset form?

#1585647

My issue is resolved now. Thank you!