Issues with Version 3.1 Hotfixes
-
Hi,
I’ve just installed this plugin and noticed two critical bugs. Unfortunately, there doesn’t seem to be any fixes from the developers as of yet, hence I’ve looked into this myself and am sharing the fixes until this is fixed by the devs themselves.
1. Multi-Day Events – Last Day Not Shown on Month Calendar
The month view does not show an entry on the calendar for a event on its last day (e.g. an event is from 1 Nov to 3 Nov, 3 Nov doesn’t appear on the month calendar).
To fix this:
Go to /the-events-calendar/lib/tribe-event-query.class.php
Find:
|| ( $record_end <= $end_of_day && $record_start >= $start_of_day )
Replace:
|| ( $record_end <= $end_of_day && $record_end >= $start_of_day )
2. Month View does not display Prev/Next month correctly on last day of month
On 31st October (today), month view shows previous month as October and next month as December as though its already November.
Because I don’t want to search the entire source on where the previousMonth/nextMonth functions are used, I’ve elected to place the fix in the function itself. It simply involves ensuring that the day used for the month is the 1st of each month. strtotime and +1 month should be used with the first day of the month, using it for the last day of the month can cause issues.
Replace the entire nextMonth and previousMonth function in /the-events-calendar/lib/the-events-calendar.class.php
/** * Given a date (YYYY-MM-DD), returns the first of the next month * hat tip to Dan Bernadict for method cleanup * * @param date * @return date */ public function nextMonth( $date ) { $day = date('d'); $date = str_replace("-" . $day, "-01", $date); return date( 'Y-m', strtotime( $date . ' +1 month' ) ); } /** * Given a date (YYYY-MM-DD), return the first of the previous month * hat tip to Dan Bernadict for method cleanup * * @param date * @return date */ public function previousMonth( $date ) { $day = date('d'); $date = str_replace("-" . $day, "-01", $date); return date( 'Y-m', strtotime( $date . ' -1 month' ) ); }
Hope this will help some people before the official fixes are given.
- The topic ‘Issues with Version 3.1 Hotfixes’ is closed to new replies.