Skip to content Skip to navigation

Stanford Events Importer 7.x-2.x

In November, 2012, SWS released a stable beta version of the Stanford Events Importer for Drupal 7. The Stanford Events Importer integrates with the XML feeds from events.stanford.edu and allows you to "automagically" import events into your Drupal site.

The importer has undergone several incarnations, starting with just a set of instructions for Drupal 6 and the now-deprecated FeedAPI module, then moving to a full-fledged Drupal 6 module, and now, the latest 7.x-2.x version.

This latest version offers a much simpler user interface for creating new importer feeds. Simply add a new node of the type "Stanford Event Importer," select the category or organization that you want to use to import events, and save the node. Stanford Event nodes will be created automatically, and they will update every 24 hours.

Instructions are available within your site at admin/help/stanford_events_importer.

Screenshot of the node add screen highlighting the 'film' category

Screenshot of the node add screen highlighting the 'Department of Physics' organization

What's Under the Hood

Picture of Matthew McConaughey from the movie Dazed and Confused

The Stanford Events Importer module relies on the Feeds module to periodically poll the XML feed created at events.stanford.edu/xml/drupal/v2.php. Previous versions of the module required end-users to know the category ID or organization ID of the desired category or organization, then pass that ID number as a parameter in the XML feed URL.

With the new 7.x-2.x branch, on install, two database tables get created, one for categories and one for organizations. The module will poll the category list at http://events.stanford.edu/xml/drupal/v2.php?category-list and the organization list at http://events.stanford.edu/xml/drupal/v2.php?organization-list to populate those database tables (on install). It also will do this with an update hook when upgrading from 7.x-1.x to 7.x-2.x.

Finally, it also checks for updates to the category/organization lists on cron runs, and adds new categories/organizations.

When a user goes to add a new importer, the module hides the Feed URL field and uses the DB tables to populate dropdown lists. Then it "automagically" constructs the feed URL with the proper category or organization.

"Featured" and "Today's" events are special cases, and are added to the dropdown for category.

For a deeper look at the code that powers this module, feel free to browse the project on github.

Categories: