Skip Navigation

[Resolved] Send email on date in custom field

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.

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

Last updated by Minesh 2 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2254595

JEN

**Tell us what you are trying to do?**

I'm creating a listing site. One of the custom fields added to the the custom post type is a date field with slug "license-expiration". We would like to send an email to the user who created the listing on the day their license expires so they can update it.

**Is there any documentation that you are following?**

This is the closest to my issue but doesn't have a resolution:
https://toolset.com/forums/topic/trigger-cred-notification-based-on-user-meta-date-field/

So many questions on this but these are the first two:
1. Should I be using cred_notification_event_type or wp_mail?
2. Think I got the cron part figured out but not sure how to check if the date is past.

Jen

#2254715

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Toolset Forms offers post expiration feature:
=> https://toolset.com/course-lesson/setting-up-automatic-post-expiration/

Have you checked that?

#2254943

JEN

Hi Minesh,

I don't think post expiration will work in this case. The notification needs to be based on a custom date field vs a length of time. The custom date field will be different for each user.

For example, someone could sign up for a year but their license expires in two months, they need to get the reminder when their license expires in two months, not when their subscription ends in one year. Their post would still remain active they just are no longer "verified" since their license expired.

Jen

#2255867

Minesh
Supporter

Languages: English (English )

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

We can set the custom date field value as post expiration time.

Please check the following related tickets:
- https://toolset.com/forums/topic/post-expiry-for-post-types-not-using-cred-post-forms/
- https://toolset.com/forums/topic/post-expiration-on-custom-post-types/
- https://toolset.com/forums/topic/set-the-post-expiry-date-to-the-date-of-event-field/

Will that help or I still misunderstood your requirements?

#2256567

JEN

Hi Minesh,

The issue is that even if the license is expired the posts should still be visible on the site. We don't want them unpublished for that, they just lose a "verified" badge if the license is expired. From my understanding post expiration will take the post down? That's why it didn't seem like the right solution.

Jen

#2257509

Minesh
Supporter

Languages: English (English )

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

The issue is that even if the license is expired the posts should still be visible on the site. We don't want them unpublished for that, they just lose a "verified" badge if the license is expired.
==>
AS you can see with the following screenshot: You can select what post status you want to keep when post is expired:
- hidden link

You can use the hook "cred_post_expiration_custom_actions" to update some post meta.
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_post_expiration_custom_actions

Please check the following related tickets:
- https://toolset.com/forums/topic/post-expiry-for-post-types-not-using-cred-post-forms/
- https://toolset.com/forums/topic/automatically-change-custom-field-value-after-a-given-date/

#2259737

JEN

Hi Minesh,

I do still need help but have not yet had a chance to try out the latest links. I think this will work though now that I know I can keep the same published state. I will be able to work on this tomorrow and will let you know how it goes.

Thank you!

#2259907

Minesh
Supporter

Languages: English (English )

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

Ok fine - please let me know if you need further assistance.