Cleaning up the Upcoming Events block in Drupal

We use the Events module to manage workshops here in the Teaching & Learning Centre, and use the “Upcoming Events” block to display the next few workshops on our website. Works great, but the default text leaves a bit to be desired. By default, it shows the event title, and “(2 days)” – which indicates that the event begins in 2 days.

But, it could also mean that the event lasts for 2 days.

So, I just added a trivial change to the event.module file, adding the following line of code at line 1847 (on my copy of the file, which was checked out on June 4, 2007):

$timeleft = 'starts in ' . $timeleft;
That changes the text indicator in the “Upcoming Events” block to read:

(starts in 2 days)

Which is much clearer in meaning. Easy peasy. I just have to remember to edit the module after updating, if this doesn’t make it in…

4 thoughts on “Cleaning up the Upcoming Events block in Drupal”

  1. Although it works, it would be better to do this in your theme, instead of in the module code. Remember: Override, don’t change. Using PHPTemplate an possible function would be: title, “node/$node->nid”, array(‘title’ => $node->title)); if ((count(event_get_types(‘all’)) + count(event_get_types(‘solo’))) > 1) { $output .= ”. t(“($node->typename)”) .”; } if($node->timeleft != t(‘Now’)) { $output .= ‘(starts in ‘. $node->timeleft .’)'; } else { $output .= ‘(‘. $node->timeleft .’)'; } return $output; } ?> Hope that helps.

    Rolf van de Krol

  2. I actually prefer it in the “15 days” way – looks less computerized

Comments are closed.


The spammers win. I've disabled comments. Again. It's just not worth having to deworm my site from the inane autospam jabber that trickles through the spam filters. Sorry. I can be contacted via the Contact form here on the site, or out on the internets.

BUT I WANT TO POST A COMMENT HERE. WITNESS THE OPPRESSION INHERENT IN THE SYSTEM.

If you need to post a response, trackbacks are enabled and will be displayed normally.

The Trackback URL for this post is:
http://darcynorman.net/2007/10/15/cleaning-up-the-upcoming-events-block-in-drupal/trackback/