Only display block when there are actually events
peashooter - July 2, 2008 - 17:01
| Project: | Event |
| Version: | 5.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi,
Do you know an easy bit of php I can slap in the block visibility box so that my forthcoming events block is only displayed when there are actually forthcoming events?
Otherwise it uses up valuable page space saying 'no upcoming events available'.
Thanks for any tips

#1
Ok, I've come up for a way to do this, but I don't know how to make it into a patch.
Around line 1857 in event.module change this:
<?php
if(!count($items)) {
$items[] = t('No upcoming events available');
}
$output = theme('event_upcoming_block', $items);
$output .= theme('event_ical_link', 'event/ical');
$output .= theme('event_more_link', 'event');
return $output;
}
?>
to:
<?php
if(!count($items)) {
$output = '';
}
else {
$output = theme('event_upcoming_block', $items);
$output .= theme('event_ical_link', 'event/ical');
$output .= theme('event_more_link', 'event');
}
return $output;
}
?>