• Resolved yunnnn

    (@yunnnn)


    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.

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 7 replies - 1 through 7 (of 7 total)
  • lizadri

    (@lizadri)

    Thanks yunnn.
    I noticed the bug 2 just today. Your fix PERFECTLY works.

    In my calendar there’s another problem. Events are not shown, but if I insert the URL of the month (november) directly in the browser then the event magically appears.

    https://www.amick.it/eventi/
    https://www.amick.it/eventi/2013-11/

    Justin

    (@jlaselva)

    yunnn, this is great, thank you.

    I’m running into another problem that you may have some insight on. Before your fix, if I had an *all-day* event that ran Nov. 8-10, it would show up on my monthly calendar on Nov. 7, Nov. 8, and Nov. 9. Now, with your change, it shows up on Nov. 10, too. However, it’s still showing up on Nov. 7 even though it’s clearly set to Nov. 8-10.

    I assume all-day events aren’t affected by the setting that controls which events in the early morning are included in the day before. An all-day event on Nov. 8 surely shouldn’t include any part of Nov. 7, right?

    Might you have any idea what’s going on?

    Thanks.

    Justin

    P.S. An example is at thisgreatwhitenorth.com/events. Check out Nov. 7-10.

    Thread Starter yunnnn

    (@yunnnn)

    @justin, try this. I haven’t tested it so I’m not sure if it’ll work or not, but I think this is probably the cause.

    Go to /the-events-calendar/lib/tribe-event-query.class.php

    Find

    ( $record_start >= $start_of_day && $record_start < $end_of_day )

    Replace with

    ( $record_start >= $start_of_day && $record_start <= $end_of_day )

    If that doesn’t work, I’ll have to look into it some other time when I’m free (since it doesn’t affect me yet).

    Thread Starter yunnnn

    (@yunnnn)

    Hi all,

    With regards to fix no 2, there are some issues with the original fix and I’ve placed a new one instead.

    2. Month View does not display Prev/Next month correctly on last day of month

    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 ) {
    			list($year, $month) = explode("-", $date);
    			$date = $year . "-" . $month . "-01";
    			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 ) {
    			list($year, $month) = explode("-", $date);
    			$date = $year . "-" . $month . "-01";
    			return date( 'Y-m', strtotime( $date . ' -1 month' ) );
    		}

    Can’t seem to edit the original post anymore, so here’s a new post instead.

    Also, I’ve noticed that the order in list view is messed up after you click on “Previous Events” then “Next Events”…I’ll be looking into this and placing a fix here soon.

    Cheers.

    Justin

    (@jlaselva)

    Hi yunnn,

    Your fix didn’t seem to have any effect on the monthly calendar display. Thanks for looking into it, though.

    Justin

    Barry Hughes

    (@websitebakery)

    Hi everyone, we actually have a maintenance release which should arrive over the course of the next week or so and that should address this.

    Thanks for your patience and support in the meantime!

    Barry Hughes

    (@websitebakery)

    As 3.2 is now available I’ll mark this as resolved (for any further issues relating to 3.2 itself please do create new threads as needed).

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Issues with Version 3.1 Hotfixes’ is closed to new replies.