Downgrading from Views 6.x-3.x-dev to 6.x-2.x

You may notice that after downgrading, you receive and error like:

Unknown column 'view_php' in 'field list' query:..sites/all/modules/views/includes/ on line 1722.

If so, backup your database and then run this mySQL query:

ALTER TABLE views_view ADD is_cacheable tinyint;
ALTER TABLE views_view ADD view_php blob;

Worked for me!

Apart from that, be sure that you've clear all of the Header, Footer, and Empty Text fields from all of your views.

Creating a dynamic menu link in Drupal

Sometimes you'll need to create a menu link that is different for each user that views it. The simplest way to do this is to create a small custom module that will add the menu link and generate a dynamic URL.

In my case, I wanted a link title 'My Company' that would redirect the user to their own Organic Group.

What to do

  • Create a menu entry

    function grasmash_menu() {
    //create menu item for My Company
    $items = array();

Overwrite Drupal jQuery behaviors on specific pages

I recently ran into a situation that required me to disable a jQuery function on one specific Drupal page. I searched for keywords like "detach drupal behavior" and "disable jQuery function in drupal," but to no avail. So I came up with a fairly simple workaround that uses the JS Injector module.

I've used this to Disable Beauty Tips, Compact Forms, and even Drupal's core password checker on specific pages.

Using jQuery to prepopulate inputs with default values, clear defaults onClick / focus

There are many ways to set and clear default form values using jQuery and javascript. Here's my preferred method. It doesn't cause any issues when javascript is disabled, and it allows you to set a different css class for empty vs non-empty inputs.

/* **

Theme Drupal Breadcrumbs

Do you ever wish that you could style a specific breadcrumb in Drupal's breadcrumb trail? Well, you can. Drupal's handy theme_ functions allow you to selectively override any function that constructs a themed element.

To theme your breadcrumbs, use the theme_breadcrumb function. Simply add a new function to your template.php following this naming convention: [your_themes_machine_name]_breadcrumb. Take a look at my customized breadcrumb function for the "grasmash" theme. It does the following:

Remove (All Day) label from CCK Date field

By default, the Date module will will append the "(All Day)" tag to any CCK Date field for which the time (hours/minutes) input has been left empty. This is pretty annoying. There are many ways to work around this, but the simplest by far is to simple override the date_all_day_label() function in your theme's template.php file.

function grasmash_date_all_day_label() {
return '';

You will need to replace "grasmash" with the name of your theme.