The Agenda module displays events before the agenda start time.
I am using Agenda 7x-1.4 with a new Drupal 7 install, php 5.3, and have the date/time module installed.
I've tested the fix suggested below on the Drupal 6 version as well.
1. This happens because the module fetches events before the start and then fails to filter those events out (although the debug script does). So two issues are involved, fetching and displaying. See #2 below for information on the fetching issue. In #3 below I give a display a fix that works for me. In #4 I will give some details on the filter/display issue.
2. I've reactivated an issue on fetching events older than "agenda start" and suggested a fix that will greatly reduce the number of such wrongly fetched events: https://drupal.org/comment/8174125 I suggest that you apply than fix first. This will reduce the difference between the number of events to be fetched setting and the number that should actually display.
3. Here's a fix that will eliminate displaying any events before the block start time setting.
In the agenda.module file find the line that reads: //sort the events by date. Insert the following code before that line:
// Filter out any fetched events that started before the block start time
$a = strtotime($block->start);
foreach($eventdata as $key => $b)
{
if ($b['start timestamp'] < $a)
unset($eventdata[$key]);
}
I've added this as a patch in a comment below.
4. Details on the filter/display issue: The debug script has a filter that removes such pre-start events, but I couldn't find any place in the module or block.tpl scripts that tries to filtered them out. However, since the debug script filters them out, I conclude the the module is designed to filter out such pre-start events.
The fetching issue fix I suggested in https://drupal.org/comment/8174125 greatly reduces the number of pre-start events fetched, but does not eliminate them entirely.
Here's why: When fetching events from Google calendar, it also returns those events started earlier than the start time, but last/continue past the start time. For example: With the "today" start time setting an event that started at 11pm yesterday and lasted until 2 am today, will be fetched/returned. With the "now" setting an event that started at 3pm and continues until 5pm will fetched/returned at 4 pm. This also happens with whole day events. The "now" setting will always fetch any whole day event for the current day. The -1 day setting goes back 24 hours before the current time, but will display any whole day events from yesterday. I doubt whether anything can be done about this anomaly, in terms of limiting the events fetched, but the display fix above will filter them out.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | [display-filter]-[2138529].patch | 518 bytes | JerryDV |
Comments
Comment #1
JerryDV commentedComment #2
JerryDV commentedComment #3
JerryDV commentedComment #4
JerryDV commentedComment #5
JerryDV commentedHere's a patch that filters the display to show only events after the agenda start time.