User login

code snippet

Upgrade between Drupal versions using a diff shell script

[This should be on its way to being obsoleted by drush, but i'm using it for Drupal 7 alpha so thought i'd finally make sure it was shared.]

Download this and other useful scripts from their public repository on gitorious.

(Please use the code from the repository, the below may be out of date.)

check for stale system table entries in one line

for file in mysql dbname -e "SELECT filename FROM system" | sed "1d"; do [ ! -f $file ] && echo $file; done

This lists all the files from the system table that do not exist in the actual file system anymore.

In our experience, this more often mean modules with bad uninstall practices, rather than modules deleted without uninstalling.

See also Enabled Modules

Add a subsection class to Drupal page body for theming Views and other parts of a site that can be defined by parts of the path

I had wanted to add the name of the view with its display to the body classes (Views apparently provides everything but that combination, and not all browsers we need to support deal with matching on two sibling classes). Looked in Zen for how to do it first though and as a consequence saw a way to add new sub-section body class with the first two parts of each URL.

This goes in your zen subtheme's implementation of preprocess page:

Converting Webforms to Display Checkboxes and Radios in Multiple Columns

<?php
/**
 * Implement hook_form_alter().
 *
 * Integrates Multi-column checkboxes radios module with Webform module. Code
 * taken from module by haplo326 http://drupal.org/user/639916 posted to this
 * thread:  http://drupal.org/node/603900#comment-2228686
function agaricgenarts_form_alter(&$form) {

Check for duplicate titles of a node with AJAX to warn immediately before entering more data or submitting

Attached is a custom module that piggybacks on Unique Field and steals most of its other code from username_checkUsername Check.

Commit message: "Working Unique Field AJAX enhancement for node titles. Pretty sweet. It doesn't take away the duplicate warning when you change the title to not be duplicate, but it does change to a green checkmark (courtesy of the username_check module from which I also stole most of the code)."

Below, tales from

Insert immediately before or after an element in a form

If you just want to insert something first in an array, as to make sure that your validation function is called first, you can do something like this:

Clean up and rationalize Drupal core Taxonomy Term Add and Edit form

I can't believe no one has done this!

Simplify the taxonomy interface for administrators by removing the taxonomy related terms box...

drupal taxonomy hide related terms
drupal form tweaks remove related terms

The commit message upon completion...

"Clean taxonomy term add / edit form by removing related terms and moving parents from the closed advanced fieldset to the open identification fieldset if the vocabulary has already been made hierarchical."

And the code:

How to add a node id to a page's CSS classes

If your page.tpl.php already prints $body_classes (or equivalent) in the <body> tag, then you likely need only to add a single line to have the nid included with a class such as "node-1".

drupal add node id to theme template
drupal add node id to page template

http://drupal.org/node/360484

Syndicate content