I just upgraded MacMegasite to Drupal 4.6. The upgrade was very easy, since it doesn’t use the event module.
Drupal
WorldBeatPlanet & ShareYourMusic updated
I now have Drupal 4.6 running at WorldBeatPlanet & ShareYourMusic.com. The only difficult part was updating to the new event module. There are a few tricks to it.
- The new event module is based on Flexinode, which I wasn’t using previously. It creates a new flexinode type for events and the upgrade script converts most of the data to the new flexinode type.
- The node type needs to be changed from ‘event’ to ‘flexinode-1’ (or whatever the new flexinode type is). It can be done with a simple SQL query:
update node set type='flexinode-1' where type='event'
- Flexinode doesn’t show the body text, so I had to add a new text area and copy the data to that field. That can be done with a SQL query:
insert into flexinode_data (nid,field_id,textual_data) select nid,2,body from node where type="flexinode-1";
- Now here’s the tricky part: You have to specifically tell it that the event type should be shown in the event calendar. That’s done in admin content under the configure tab.
I was previously using an ugly theme hack to allow WorldBeatPlanet and ShareYourMusic to share the same content but with a different appearance, but Drupal 4.6 provides a much nicer way to do it. Instead of conf.php it now uses a separate settings.php file for each site. You can now specify a database prefix only for certain tables. I now have both sites using the same database so the content & user list is shared, but each uses different blocks, boxes, menu, variable, and cache tables, so I can change the block layout & menu structure for each site.
Drupal 4.6
I’m now experimenting with Drupal 4.6 on WorldBeatPlanet. I’ve only tried it locally, but everything seems to work nicely so I’ll probably go live with it in the next day or so. The hardest part was switching to the new Event module, which is based on Flexinode.
I have the discography module working very nicely now. It can display a list of artists only, a full album list for all artists, or the full album list for a single artist, and it shows links to purchase albums at Amazon or iTunes Music Store when available.
Discography module
I’ve written a Discography module for Drupal, which I’m now using at WorldBeatPlanet. I got annoyed with the seriously outdated album lists, which were static text pages, so this module takes advantage of Drupal’s database to store album information as a new node type. A URL like http://www.worldbeatplanet.com/discography will display the full discography for all artists, and by specifying the artist name, it will display the discography for only that artist (like this).
Theme hack
I now have ShareYourMusic.com pointing to WorldBeatPlanet and sharing the same content. However I hacked the theme to switch the style sheet, title, and logo based on the host name, so the user will see a different appearance if they visit worldbeatplanet.com or shareyourmusic.com. However, I found that I had to disable Drupal’s cache, or it will sometimes display the wrong page.
Fix for a long-standing bug
Due to the way permissions are set up on MacMegasite & WorldBeatPlanet, when a non-administrative user submits a story they’ll get an error ‘access denied’ even though the story is submitted properly. This happens because Drupal tries to display the newly submitted article, which is unpublished. However, non-administrative users can’t view unpublished items, so they get the error. With some digging in the forums at Drupal.org, I found this fix.
In node.module, look for the function node_submit and change the following two lines at the end of the function –
Original:
drupal_set_message($msg);
drupal_goto('node/'. $node->nid);
New:
if (node_access('view', $node)) {
drupal_set_message($msg);
drupal_goto('node/'. $node->nid);
}
else {
return $msg;
}
This verifies that the newly submitted article can be accessed before it attempts to display it.
Preventing comment spam
A new standard HTML tag supported by Google and other search engines will help eliminate the incentive to post comment spam. When the attribute rel=”nofollow” is added to a link, that site won’t be credited for the link and its search engine ranking won’t be raised. Ideally, blogging software should automatically append it to any user-provided links.
I’ve implemented it in Drupal with a simple patch to filter.module. Add the following line near the end of the function _filter_html, just before the line return trim($text);
$text = preg_replace('|<a.+href=([^>]*)>|','<a href=$1 rel="nofollow">',$text);
Both MacMegasite & WorldBeatPlanet are running that patch now.
Burn it!
Since more than half of the visitors to MacMegasite read the RSS feed, I’ve decided to take advantage of it by putting ads in the feed, using FeedBurner. Since FeedBurner doesn’t modify the original feed but creates a new modified feed, I needed a way to get ads in my existing feed. One way to do it is by adding a redirect for the RSS file.
Since Drupal uses a dynamically generated feed, that isn’t so easy. I figured out a simple work-around with a small patch to node.php. My patch creates a private feed URL and redirects /node/feed to the FeedBurner feed. Here’s how to do it:
Find the function node_page() in modules/node.module and look for the switch statement which dispatches the command. You’ll see the following lines:
case 'feed': node_feed(); return;
Change it to
case 'something_random_here': node_feed(); return; case 'feed': header("Location: http://feeds.feedburner.com/macmegasite"); return;
Use some random value for the command which will invoke node_feed() and use that only as feedburner’s source. Now your private URL is used to access the actual RSS feed and /node/feed will be redirected to feedburner’s modified feed.
Lyrics module for WorldBeatPlanet
I just wrote a Drupal lyrics module for WorldBeatPlanet to replace my old hack of using a page with the taxonomy term ‘lyrics’. It’s a very simple node module which adds an artist field and has a nicer overview page listing only titles & artist.
WorldBeatPlanet news
A few days ago I got a very nice email from Jimi Mbaye praising WorldBeatPlanet. He has a new album, which isn’t available in the US, and he now has his own studio and has been producing albums for other artists.
I’ve rearranged the topics at WorldBeatPlanet and eliminated the regional topics, since so much music crosses regional boundaries.
I’ve also been experimenting with a professional Drupal layout for an artist-oriented site. Instead of a news page with user-submitted stories like I now have at WorldBeatPlanet & MacMegasite, it will have artist-related pages. Only registered artists can create pages and each artist can have his own forum.