Drupal Development Blog is brought to you by Face 2 Interface, home of open source applications for your website.

Creating a New Module

I've been following along with the tutorial on drupal.org and it was pretty easy to get done.
There were only two issues that came up :

  1. The tutorial is written for Drupal 4.6/4.7 and I'm running Drupal 5.1. Perhaps for this reason, in addition to the steps described in the tutorial I found it necessary to create an onthisdate.info file - until I did this the new module did not show up on the admin > modules screen.
  2. The module is designed to only display links to content from a specific date which for a new site like this means it may show nothing at first run. That is a easy enough to work around, to at least get some result:

    function onthisdate_block($op='list', $delta=0) {
    [snip]
    $query = "SELECT nid, title, created FROM {node} WHERE created <= '" . $end_time . "'";

    /*
    $query = "SELECT nid, title, created FROM {node} WHERE created >= '" . $start_time .
    "' AND created <= '". $end_time . "'";
    */
    [snip]
    if ($block_content == '') {
    $block_content = "no content from a week ago, return query eq $query";
    // return;
    }
    [snip]
    } // end onthisdate_block