The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Becoming a Drupal coder: a wise career move

Submitted by nk on Sun, 2010-03-14 23:46

-- Please help getting the word out by reposting this for various programmer-but-not-Drupal lists groups etc.

Drupal 7 multistep node forms are easy

Submitted by nk on Mon, 2010-03-08 01:21

The bane of multistep node forms are validation errors. But Drupal 7 has a cure. Not nice but a cure.

Slap #access = FALSE on form elements you dont want to see in the current step and then set up the Next button with #limit_validation_errors set to the elements you are about to see. The Prev button should get an empty #limit_validation_errors. Should field validation errors bother you, you can nuke those in hook_field_attach_validate.

<?php
define('MYMODULE_STORY_NODE_FORM_LAST_STEP', 2);

Multiple forms together

Submitted by nk on Sun, 2010-03-07 02:45

I have written a Drupal 7 module which allows you to put together any number of forms into one <form>. For example, if you have a professor with various titles and you have created a title entity with the various fields necessary to describe that title then you can show all the title entity forms on the user edit form in a seamless manner. Co-maintainers are welcome.

VAAPI on Ubuntu Karmic Linux

Submitted by nk on Thu, 2010-02-25 21:07

I wanted to test VA API with my Lenovo T400s (GMA4500HD aka G45). You first need to install libva and then a libva-enabled mplayer. The only problem I have encountered is that the Debian package in the libva I downloaded disabled the i965 driver. I have reenabled it, it seems working. After installing, I found a small problem, reported on the Phoronix and the hkepc forums both: the skin of the people become blue. This can also be fixed easily.

Quickly navigating the deep directory structure

Submitted by nk on Mon, 2010-02-15 07:44

This works only on Linux:

chx@veyron:/var/www/drupal$ tail -3 /home/chx/.bashrc
function go() {
  cd `find . -type d -name $1`
}
chx@veyron:/var/www/drupal$ go views
chx@veyron:/var/www/drupal/sites/all/modules/views$

Do not use github

Submitted by nk on Thu, 2010-02-04 11:24

If you use git then use gitorious or repo.or.cz or anything that's not github. Reasons:

  1. github source code is not available. This makes me very uncomfortable. Who knows what might happen to the source code hosted there. I am not saying they will sneak in a backdoor but they could.

Rapidshare premium account download script

Submitted by nk on Tue, 2010-01-26 08:57

Although the web is full of scripts to help downloading from rapidshare with a premium account, none of them seemed to work for me. First, create a cookie file: curl -k -c .rapidshare -d 'login=USERID&password=PASSWORD' 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi'. In the browser first you click the "premium user" button, second you click "download". We download these pages because the first contains the number of the rapidshare server actually containing the file, like rs123.rapidshare.com and then the mirror like rs123gc3 for Global Crossing.

<?php

Drupal 8: everything is pluggable

Submitted by nk on Sat, 2010-01-23 20:17

In previous Drupals we had a rough version of plugins -- you could load a cache plugin instead of cache.inc but that was all. The pluggability was on file level and it only existed for very few files. Drupal 7 introduced many more pluggable subsystems and now the pluggability happens on a class level (mostly). We can plug in sessions, cache, queue, field storage, password hashing... Crell is working on unifying these for quite some time now. And this is all good, however, for Drupal 8 I would like to see a lot more.

Some Drupal 7 porting tips

Submitted by nk on Fri, 2010-01-22 08:32
  • UPDATE/INSERT often can be updated to a single db_merge.
  • Don't forget to ->execute() your db_select/db_insert/etc
  • Themes can have many variables and you might want to do
    function theme_fivestar_preview($variables) {
      $theme_definition = fivestar_theme();
      foreach ($theme_definition['fivestar_preview']['arguments'] as $key => $default) {
        $$key = $variables[$key];
      }

    Edit: merlinofchaos suggests simply extract($variables, EXTR_SKIP); because that's what templates do.

Just how big we are?

Submitted by nk on Fri, 2010-01-15 13:55

Up until now, Drupal tried (and tried hard) to work with every nick-and-dime shared hosting companies. We have changed course with the launch (and the success) of the GoPHP5 movement allowing us to use PHP 5.2 in Drupal 7. But that required a movement and was a huge change. I would believe that by now Drupal is large enough that it can set up some smaller requirements instead of worrying about which host will and which won't support it. One such has long been a problem -- the memory requirements -- but this as a problem affecting everyone and is filed and worked on as a critical bug.

User login