Show future dates
Is there a way, in the admin, to show only records with a date in the future by default?
I've got a section with restaurant bookings, and want to show only future bookings, but also sort those in the future by date.
If no easier way, I was thinking of trying to create a plugin that made an "archive" checkbox ticked if the date is past? Then sort by archive,date?
Here is one way you could set up an automatic advanced search filter on the bookings records. Create an advanced search option for date. Add a link to the Booking seciton editor filtering by date that uses PHP to get the current date plus one. Here are the steps:
1. Create an advanced search option for date in the Bookings section editor.
- Go to Admin > Section Editors > Bookings and click on the Searching tab.
- In the Search Fields text box, in a new link under _all_ enter Minimum Date|date|min
Now you can go to the Bookings section editor and advanced search by date. Example: 2016-10-18
2. Next, download and install the Modify Homepage Add-On:
3. Edit the modify_homepage.php to include a link to View future bookings:
<li><a href="?menu=bookings&_defaultAction=list&page=1&showAdvancedSearch=1&&date_min=<?php echo date("Y-m-d"); ?>">View future booking</a></li>
Now a user can click on the top left logo/text in CMS Builder to go to the homepage where the link will appear. Clicking the link will filter the Booking results by minimum date.
Does this sound like a workable solution for what you need?
Hire me! Save time by getting our experts to help with your project.