for now this is mostly just a place for me to track posts, news feeds, ideas and code snippets
(Submitted Thu, 2009-07-30 20:37)

Here's a quickie. Automatically disable comments on posts older than a given timeframe. I find that comments on posts older than a few months are generally spam.

Plug this into your site's custom module. As usual, I am using the convention of 'mymodule' for the namespace, and you'll want to replace this with the name of your actual module.

<?php
function mymodule_cron() {
 
$time_ago = strtotime("-4 month");
 
$result = db_query("UPDATE {node} SET comment=1 WHERE created < %d AND type='story' AND comment=2", $time_ago);
}
?>

Exercises for the reader: you could also make a settings page to make the "time ago" configurable (currently I have mine hard-coded to 4 months) and the node types to which it applies configurable (currently I have mine hard-coded to 'story' nodes)

(Submitted Fri, 2009-07-24 21:13)

I generally get called on to projects to do custom module development and internal architecture/engineering, so I have increasingly less frequent contact with the front end tools and site building type modules. But I've been playing with Panels again lately for a project and ran into an issue with block visibility. While Panels will generally give you an option to respect a block's configured visibility settings, for blocks generated via Views, it does not (even if you have specified visibility rules for that block via admin/build/block). I suspect this is because Panels invokes Views generated blocks directly thereby bypassing that extra 'layer'.

Read on for one solution to this problem.

(Submitted Fri, 2008-12-19 03:24)

Today John Resig of jQuery fame released the FireUnit extension, which provides a method for unit testing javascript, integrated with Firebug. Seeing as how jQuery itself has become such an integral part of most Drupal developers' work, this looks very promising.

You can read his post about it over here.

(Submitted Sun, 2008-12-14 21:14)

Recently I was contacted by an individual who I have done some Drupal work for in the past. He has an older site that is primarily static HTML with a perl script handling contact form submissions. As most of us experience once a website has become established, he was getting inundated with spam through his contact form.

He was willing - though not overly eager - to implement a CAPTCHA solution but was worried about introducing an extra hurdle for those making casual inquiries. As the various spambots were filling in all the form fields with mostly random garbage and their website links, we decided to just do a validation on the phone number textarea and reject the submission if the phone number validation failed.

Read on for a sample implementation of 'reverse CAPTCHA' aka 'negative CAPTCHA' as an extension to the existing Drupal CAPTCHA module.

(Submitted Sun, 2008-12-14 15:43)

I finally got around to upgrading this site from its ancient 4.7 era codebase to the latest security release of 5 (upgrade to 6 coming in time). There is a bit of funkiness in that a few posts don't display their body text in the the full node view, but do display teasers, so I'll have to go through and track them down. Overall though, fairly painless.

I plan on making a few posts of code that might be useful to some people, and a couple of articles, over the holidays.

(Submitted Sun, 2007-12-30 20:52)

Owing to a long development period, and several changes of the core development team, we have a lot of leftover Views that are no longer being used. However, with pages upon pages of them and quite a large site, it isn't always immediately apparent which Views are still needed and which aren't.

Here is a very small module I quickly threw together yesterday to track when Views are called/rendered and generate a report at /admin/views_audit. I doubt that there is enough general need for this to put it in contrib, but someone out there might get some use of it.

It should be just as happy running on 4.7 as 5.

(Submitted Tue, 2007-06-12 18:32)

I don't usually use this space for this type of thing, but we are currently seeking a CSS ninja for immediate work. Drupal know-how is a definite plus (and if you are reading this, you probably have that).

Solid performance will almost certainly result in repeat work.

Use the contact form if you are available and interested. It would be helpful to quote your rates and provide a couple of urls to finished projects.

(Submitted Tue, 2007-04-10 17:57)

I've been developing an AJAX module for a client that needs to run on both Drupal 5 and Drupal 4.7. Unfortunately, the jQuery 4.7 module uses the now well outdated 1.0.3 version of jQuery and I was finding a number of incompatibilities cropping up between the more recent Drupal 5 version and the older Drupal 4.7 version.

Here's a simple way to bring your Drupal 4.7 up to date with the current version of jQuery, and to allow for simple upgrades when new versions of the library are released.

(Submitted Sun, 2007-01-28 20:16)

Here's a wacky idea - arbitrary attributes that can be assigned on an individual node basis.

Even wackier - a brokerage system to allow these attributes to be globally registered.

What do I mean, and what's the point?

Right now, developers do all sorts of strange things to coax desired behaviour out of Drupal. Consider the case of featured content. You want certain types of content to be "featured", and you want to perform certain types of actions for featured content that you don't want to perform for other content. Perhaps a featured icon graphic next to the title in a teaser view.

There are countless ways that a scenario like this gets tackled, three in particular which are most common. I don't think any of them are adequate.

(Submitted Mon, 2007-01-22 02:49)

After having taken a few unexpected months off from most Drupal activities, I've been dipping my toes back into the water this week.

It's great to see that Drupal 5.0 has been officially let loose into the world. I'd played with and tested some of the pre-release dev versions, so it isn't entirely new territory for me, but I've still got a bit of catching up to do. I'm working on the first production site with 5.0, and I'm loving it. Cheers to everyone who has worked so hard to make it happen.

So that's the good.

The "not so good" is the spam on this pre-5.0 era blog. Lots of it!