Drupal

Use drush to bulk-update pathauto aliases

After changing the pathauto pattern for a node of type foobar, each node must have pathauto_node_operations_update() run on it.

Running drush without a bunch of header info

Edit the wrapper script drush/drush and add a -q flag to the exec php call, like so:

<?php
# We check for a command line (cli) version of php, and if found use that.
which php-cli >/dev/null 2>&1
if [ "$?" = 0 ] ; then
  exec php
-cli $SCRIPT_PATH --php="php-cli" "$@"
else
 
# Alternatively we run with straight php, which works on most other systems.
  # The --php=`which php` is for Dreamhost, which behaves oddly.  See http://drupal.org/node/662926
 
exec php -q $SCRIPT_PATH --php=`which php` "$@"
fi
?>

Quick Sectional Blocks

I ran across a module to create site sections somewhere... but needed a quick solution for a single block. I wanted the block to show up if and only if we're on a page which is in the menu structure as a child of the first primary link. Enter "Show if the following PHP code returns TRUE" and voila:

<?php
  $tab1
= array_shift(menu_tree_page_data('primary-links'));
  return
$tab1['link']['in_active_trail'];
?>

Firefox caches form values

Firefox caches form values. Most noticeably, it caches the selected position on select boxes. I less often run into cached checkbox and radio button values... even the occasional cached text box value. If you're a developer, you will be familiar with this and its work-around -- clicking into the url box and hitting enter rather than refreshing while debugging.

Setting a CCK default value for old nodes

I added a brand-new cck field to a content type which already had a bunch of nodes, but previously had no cck fields. This new field needed to have a default value set for all existing nodes. Of course, editing an old node and saving it without making any changes would set an appropriate default value... but I couldn't manually do that for all the nodes.

Syndicate content