2009

Rendering External URL Aliases as External Links

Drupal 6 doesn't seem to mind if you save an external URL as a node's path alias. Rendering it, however, throws the full, escaped URL as a path within the site. For some reason (I'm guessing .htaccess), those links still end up going to the external URL, but they look most ugly, and don't trigger External Links processing.

So, the key is the custom_url_rewrite_outbound function. This weird, quasi-hook of a function can be placed in settings.php to affect the behavior of links generated by url(). As noted in that documentation, url() may be called dozens of times in a single page request, so performance is extremely crucial here.

migrating from D5 upload module to D6 cck filefields

I'm working to update a Drupal 5 site that uses the core upload module to a Drupal 6 site that uses CCK Filefields. I found some work on handling this by drewish, but it needed adapting for my uses.

Programmatic Carts and Orders in Ubercart

Here is a (somewhat raw) function that will place an order in ubercart on behalf of a given, fully-loaded account. It all happens in code, bypassing the multiple-screen checkout process of UC.

This means you have to have all the info you need for the order already stored somewhere, of course. In the use case that spawned this code, it is being gathered through a series of custom forms.

Blocked Note

Attached is a little module that allows users with the 'administer users' permission, which gives them the right to block a user, the ability to add a note to the blocking action. When the blocked user tries to log in, if they provide valid credentials, they see the note as an error.

Now when you drop the banhammer, they know why they're hurting.

This has to mess with the validation functions of user login, so it may have conflicts with other modules that do the same thing, like logintoboggan. Reordering module weights may help; I haven't tried.

Slouching towards PCI Compliance

I'm starting work to bring a drupal site towards PCI compliance and I thought it might prove handy to document it.

Sadly, I must work towards Self-Assessment Questionnaire D, which is not short. This post is going to focus on Requirement 8: Assign a unique ID to each person with computer access.

Initializing and Refreshing a Multi-Step Form

I've been working on a relatively complex multi-step form for a while now. It takes a URL argument that represents a set of stored options to control display and behavior. Thanks to $form_state['storage'] that is pretty easy to grab once and keep through all the steps.

broken closed captioning on a tennis match

great chance for get wederly lyshowe stunn 15 minn G E S start out b ck is wsoonoittle ve offshides cincinnat realtsonga his backing

A nice addition to comments

Here's a little snippet for hook_form_alter that will put another "Save" button right below a comment preview. This way users don't have to scroll all the way down past the edit form to save a comment after preview, it's right there.

This is for Drupal 6.

<?php
 
if ($form_id == 'comment_form' &&($form_state['post']['op'] == t('Preview'))) {
   
$form['top_submit'] = $form['submit'];
   
$form['top_submit']['#weight'] = -19;
   
$form['top_submit']['#suffix'] = t('Save your comment, or make changes below.');
  }
?>

Faceted Drupal Certification

in

There's been some buzz about Drupal certification programs recently. Whoever takes up that task, if anyone does, I hope they implement focused certification instead of some monolithic certificate.

Server configuration, themes, module development, site architecture, and the like are all sufficiently advanced topics to merit their own certification. Breaking it down like that might also help realize certification programs sooner, if organizations could focus on developing a program just for the topics they specialize in instead of the whole of Drupal.

Anonymous Comment Email Verification

Attached is a module that requires anonymous comments to have the supplied email address verified before they enter the normal comment workflow.