There's a telepathy module for that.
Today I Learned...
Removing Behaviors Using a GMap Macro
I'm building some maps for a client using the GMap module and came across the following simple problem: using a GMap macro, how do you remove a default attribute?
The GMap module lets you set a number of default attributes for your maps: width, height, center position, initial zoom, and so on. If you want to change any of the default settings for a given map, you need to specify your overrides in a GMap macro, which looks something like this:
[gmap zoom=3| width=500px |height=350px]
It's all simple enough until you get to the behaviors.
Preventing empty CCK-based blocks from printing
Today I learned that if you have a Views-powered block that uses CCK fields; and the CCK fields are empty for all the returned rows; then Views doesn't realize you've got an empty set and it still prints all the scaffolding for your block – the admin links, the container divs, and so on. The content of the block is empty, but the HTML still takes up space and throws off your layout.
Fixing this is easy. To prevent an empty CCK field-based Views-powered block from being output, add a filter on the CCK field and set the filter to Is not empty (NOT NULL).
Keep Drush Up to Date
We're big fans of Drush. It's installed on all of our servers and it's a great way to perform maintenance tasks, download core and modules, and much much more. I'm not a big fan of installing from zip files though, so let's use git to easily keep our Drush install up to date.
Set Sitewide Default Context in Drupal
In Context 3 they removed the sitewide default context, that is, the context that can be set to be enabled when no other context is active. The sitewide context, which is enabled at all times, is still available.
But, in its place, Dev Seed has added a very powerful feature, sneakily powerful, in fact.
You can set a context to be active using another context. Seeming kind of meh? Well, read on. You will soon see, young apprentice, just as I did just earlier today.
First, name all the contexts you DON'T want this context to coincide with in a regularized way, like
Delicious Feed Broken? Delicious Changed Its Domain Name
I ran into an issue recently where Delicous links weren't being updated as expected. It turned out sometime in August 2010 Delicious switched from using http://delicious.com/ to http://www.delicious.com/
I fixed my problem by changing the Views filter from http://delicious.com to http://www.delicious.com
Most changes should be as easy as that.
Updating your Drupal site using Drush
A few weeks ago, Alan wrote about how to find out if your Drupal and Wordpress sites are up to date. So, what if you find out your Drupal site is horribly out of date - core, modules and all? What then?
If you run the script Alan wrote about, or you simply notice the alert in the admin section of your site notifying you that your site has updates available, most of the time you'll want to implement at least some of these updates.

Making Drupal Happy: When Themes and Modules use the same name
We came across an issue with a site recently, where the name of the custom module file was the same as the name of the theme. So, for example, if the theme name was Bork, the module name was bork.module. This can cause a variety of problems since the two share name space. Problems can include blocks disappearing (both from your site, and from the /admin/build/blocks menu), printing $content returns only 'array,' and more.
Custom CKeditor Classes in Style Dropdown
While looking up how to add custom styles to CKeditor's dropdown, I came across a helpful yet tiny custom module from my friend rootwork.
Turn it on and hack on it to add new styles. You can't add styles to the 'a' tag, FYI, create a style for a span tag instead.
Customizing ShareThis WordPress plugin
WordPress Stylesheets: wp_enqueue_style
If you're building a WordPress plugin, or simply dealing with including WordPress stylesheets in your theme, there are a few approaches you can take. For the most part, I've included stylesheets for WordPress sites in header.php, since (obviously), header.php is included in every other site file. It seems this is relatively standard practice for WordPress sites. I see it all the time:
?>/example.css" title="example" />
drupal_write_record() Can Return a False Positive on Updates
Today I discovered that the 6.x version of drupal_write_record() returns '2' (or SAVED_UPDATED) even if no record was updated.
In order to update a record via drupal_write_record(), you have to provide both:
a) the primary key value for the record you're updating
b) the field name of the primary key or keys (e.g., 'nid')
I'm not really sure why b) is necessary, since Drupal should be able to get that information from Schema, and a prerequisite for using drupal_write_record() in the first place is that the table you're writing to was defined with Schema.
Anyway, an example:
The Butterfly Effect
The Butterfly Effect is a term from chaos theory that is designed to illustrate how one tiny change can have enormous consequences to the overall system down the line.
If we abstract butterfly to bug, it actually fits quite nicely within the realm of software development.
Modify Views SQL Query in Drupal, Restrict View to Search Term
So I wanted to be able to pass a default value to the the Views search filter, to filter by a view by a search term, to display that view in a block.
EDIT: There is an easier way to do this, which renders this whole tutorial useful only for other SQL hijacking. Under Filter, select Node: Body. See screenshot.
I had two options, create a view, create an RSS feed, run it through Yahoo Pipes, and cycle it back through, or modify the views query.
Drupal 6.x + jQuery 1.4.2 = New Possibilities
jQuery is the bread and butter of rapidly developing a highly-interactive websites, and Drupal has long made use of it, and indeed includes it as part of its core install.
Shared Multisite Sign-on the Easy Way
This weekend I discovered (quite by accident) a very simple way to enable shared sign-on across multiple Drupal sites running in a multisite configuration.
Suppose you have the following sites:
- phones.com
- htc.phones.com
- iphone.phones.com
- motorola.phones.com
The first requirement is that all the sites be running on the same domain. The examples above work — they're all subdomains of phones.com.
The second requirement is that all the sites share the same user tables.










