Support

Home Forums Event Espresso Premium BUG: Incorrect end date when filtering attendees by month

BUG: Incorrect end date when filtering attendees by month

Posted: February 3, 2014 at 3:45 am

Viewing 1 reply thread


Luke Morton

    February 3, 2014 at 3:45 am

    There’s a bug in Lines 191 and 192 in event_espresso/includes/event_management/queries.php

    Lines 191-192:

    $SQL .= $month_range && $attendees && ! $event_id ? ' AND a.date BETWEEN "' . $year_r . '-' . $month_r . '-01" AND "' . $year_r . '-' . $month_r . '-' . $days_this_month . '"' : '';
    $SQL .= $month_range && ! $attendees && ! $event_id ? ' AND e.start_date BETWEEN "' . $year_r . '-' . $month_r . '-01" AND "' . $year_r . '-' . $month_r . '-' . $days_this_month . '"' : '';

    $days_this_month holds the current month’s total number of days, not the total number for the month being searched.

    Thus, if the current month is February, it fails to return any attendees for an event on the 30th of January because that event is outside the date range (01-28).

    A possible fix follows, but it assumes a MySQL database (EXTRACT isn’t standard SQL).

    Lines 191-192:

    $SQL .= $month_range && $attendees && ! $event_id ? ' AND EXTRACT(year_month FROM a.date) = "' . $year_r . $month_r . '"' : '';
    $SQL .= $month_range && ! $attendees && ! $event_id ? ' AND EXTRACT(year_month FROM e.start_date) = "' . $year_r . $month_r . '"' : '';

    • This topic was modified 10 years, 8 months ago by Luke Morton.
    • This topic was modified 10 years, 8 months ago by Luke Morton. Reason: Tags getting mangled


    Sidney Harrell

    • Support Staff

    February 3, 2014 at 1:50 pm

    or up at line 65, insert the following line after it and before the closing brace:

    $month_r = $pieces[1];
    		$days_this_month = date('t', strtotime($month_range));
    	}

    Thanks for the report, I’ll raise a ticket to have it fixed.

    Viewing 1 reply thread

    The support post ‘BUG: Incorrect end date when filtering attendees by month’ is closed to new replies.

    Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

    Event Espresso - Staging Server