Recent Drupal Posts

Excluding Node Types from Search

Ran into an ugly problem this morning. Drupal was indexing non-public nodes and showing their snippets in the search results, basically leaking private information. I am sure there is some clever access control way to deal with this, but I ended up just knocking them out on the theme level. Since I already had a phptemplate_search_item function in my template.php (for aesthetic reasons), it was just a question of adding this as the first line (as per


Ahah Session Slides

Wow, the Summit was quite something. My head is still spinning from all the new info. I think my session went really well. Got some good questions, and feedback. Still need to figure out how to do the dynamic forms thing without opening up a security hole. More on that soon. Until then here are my slides:

Ahah_forms reloaded

Let's start with a review for those who have not already drunk the ahah forms framework kool-aid: Ahah forms is a utility for attaching Ajax-style partial page loading to Drupal forms without having to code any javascript. This is similar to Ruby on Rails' link_to_remote tag or form_remote_tag() function. The method I use to declare the binding is a custom extension to the formAPI.

views_ui reloaded

Stepping up to the plate

Back to our story of Ajax vs the Drupal Form API. After modifying poll.module to work with ahah_forms in a couple of hours, I was feeling cocky, and decided to go for the gold ring: Views. I use views a lot and think it is one of the key drupal modules.  And it is the perfect target for Ajax, because creating a View can take over a dozen page refreshes.  I went in optimistic.  If you read my first post on this topic ( )
you will remember that the hardest part of the process is getting your dynamic form to work without JavaScript, and views_ui already had that nailed.  At the end of my first day's work I thought I was 90% of the way there.  At the end of my second day, I knew I was in trouble.

Update: I have just released version 1.3 of ahah_forms, which includes a significantly simplified version of views_ui.module-example.  I realized that since I was not able to accomplish my goal of per-section form processing, I can limit most of my changes to the theming functions. Most of the discussion below is still valid.

CSS Drop Down Primary Links

Quick digression from Ajax. The was a thread on the developers' list about drop down menus, so I thought I would share my approach. This is an pure CSS solution (The .css is probably too site specific to be generally useful, but I included it as an example).

Views and Ahah Forms 1.1 released

I am excited to announce the release of the work I have been doing to modify ahah_forms and views_ui to work together. It took weeks longer than I anticipated, and required extending ahah_form.js and tweaking maybe 20% of views_ui, but I am very happy with the result. You can check it out yourself at The views_ui rewrite is available in the examples directory of ahah_form 1.1 (

Find URL Alias

I am starting to really grok the drupal module release system. I just packaged up and released a little utility I have been using as a module. Find URL Alias ( adds a "Find alias" tab to the URL Alias admin page, so you can type in an alias and jump directly into editing/deleting the alias, or viewing/editing the node. It also tells you if you have multiple aliases to the same node (a SEO no-no).
If this doesn't sound useful to you, I bet you aren't using pathauto :)

Speaking at OSCMS Summit

Wow, the schedule for the DrupalCon Sunnyvale is out, and it looks like I am in the Big Room, in the slot between Jeff Eaton and Steven Wittens. Boy, no pressure there. I guess the intersection between Drupal and Ajax is on a lot of peoples' minds right now.

hook_init and require_once

I have been having some trouble figuring out the proper way in 4.7 to break my huge module up into submodules. I have a module that defines multiple node types, so I pulled each node type out into a seperate .inc file. Back in the 4.6 days, I just included them directly into the main module

= drupal_get_path ( 'module' , 'main' );
if (
file_exists ( "$module_path/main.module" )) {
"$module_path/" ;

Upgrading OG to 5.x

Important Organic Groups tip: when you are upgrading from 4.7 to 5.x, be sure to disable og from the organic groups settings page, then turn off the og module, before you do your upgrade. Upgrade, then turn on og and upgrade it, then re-enable it. Otherwise all your groups might wind up empty of content.