In this article, we will be going over the process of how to add end/expiration dates for single-image post types like Events, Jobs, Articles, Coupons, and Blog Articles.
The way to accomplish it is by adding a hidden field controlled by the admin.
With this method, the admin of the website can add a Hidden Field into the Single-image post's custom form and set the number of days until the post is set to expire. Once a post is created and the number of defined days has passed, then the post will be automatically marked as expired and no longer display in the website's search results. The member cannot edit or modify this expiration date.
To accomplish this, navigate to Toolbox >> Form Manager and customize one of the following forms:
-Feature - Jobs
-Feature - Member Articles
-Feature - Coupons
-Feature - Blog Articles
-Feature - Events
For this example, we are going to edit the Member Articles form.
Click on the Add Field button:
This will generate a blank field:
Fill in the information as it can be seen down below and click Save Changes:
- Field Type
Select: Hidden Field - Field Label Name
Type: Expired - Database Variable
Enter the following variable: post_date_interval - Default Field Value: Enter the number of days until this post expires. In this example we are using the number "30", representing 30 days from the publish date.
NOTES:
- If the post does not have a post_expire_date but does have a post_date_interval value, it will expire X number of days (based on the value of post_date_interval) after the post start date.
- By default, the events form will have a field for the member to set the expiration date. If they do not select an expiration date, then the system will use the post_date_interval value.
This is the form that needs to be edited: Feature - Events