Useful Drush Commands


Log out all active Users:

drush sql-query 'TRUNCATE TABLE sessions;'

Download drupal and rename:
Downloads and renames to web

drush dl drupal --drupal-project-rename=web -y

Install Drupal database:
Installs drupal when executed inside the drupal folder.

Troubleshooting: Node Reference field always displaying 10 results when using the Advanced View option in Drupal 6

This problem particularly occurs when the views is upgraded to 3.x in Drupal 6. The nodereference field which gets list data from a view returns only 10 results irrespective of whatever is set on the views page.

There is an easy solution to alter by modifying the items_set_per_page using views hooks.

Fixing Issue: Fatal error: "Maximum execution time of 240 seconds exceeded"

Search for drupal_set_time_limit in Drupal directory and modify the line as below. Ensure that it is restored later once the required operation is over:
For example: Modify the following line in file in includes/


and set to 1800.

Get URL Parameters


There are multiple methods for getting current URL parameters. The following seem to work fine.

filter_input — Gets a specific external variable by name and optionally filters it . Works on PHP 5 >= 5.2.0.

The following code gets the districts from the url provided in the parameter field_district_ref_nid. The filter input converts the result into an array.

Drupal l() and url() methods

Both l and url methods are handy to create urls for various entities. However, the variety of options available makes the usage exciting and complex.

l(): Formats an internal or external URL link as an HTML anchor tag.
Syntax: l($text, $path, array $options = array())

Creating an absolute URL using l(). The example below creates a node link.