David Lohmeyer's Blog

Quickly upgrade Drupal core: only different files

Here's a handy commandline snippet that will help you upgrade Drupal core (for example, 6.19 to 6.20) without having to replace everything.  It will only update the files that have changed.

Disabling the backspace key on a page with jQuery

I had an issue with a multi-page form recently where Internet Explorer would go back a page immediately upon hitting the backspace key.  If you accidentally do this while not in a text field you'll lose your form data.  Other browsers actually ask you if you want to resend data when you go back.  The solution was to disable the backspace key on my form page.  I accomplished this with the following Javascript (requires jQuery):

Redirect webform submissions to a dynamic URL in Drupal 6

If you need a way to redirect webform submissions to a dynamic URL in Drupal 6, using the Webform PHP module can work well with Webform 3.x.  I recommend only using post processing conditionals on select fields if possible with Webform PHP since you need to enable the permission to "use PHP for additional processing" for users who submit webforms (typically anonymous).

Here's the process:

Thoughts on programming languages

I've been expanding my programming language base lately.  Being a web developer, I don't have an immediate need to learn other languages.  However, learning them seems to pass time and it doesn't seem like a worthless endeavor.  Who knows, being the one who creates the next "killer app" could be worth it.  Here's an overview of some of the languages I've been experimenting with:

Using PuTTY to manage your SSH logins in Windows

This may be something you already do if you're a web developer or have anything to do with Unix but I figured it'd be a decent reference for someone just starting out.  PuTTY is your SSH client for Windows which stores login information to remote servers.  It makes it so you don't have to do things via a regular command prompt manually every time you need shell access.

What you need

JQuery Dropdown Menu Styling in Drupal

DrupalSN posted a nice guide to styling exposed View dropdown menus with a JQuery plugin and some stylish CSS.  The guide there worked perfectly except for the step where he hid the submit button.  I changed this:

.views-exposed-form label,
.jquery_dropdown_page .views-exposed-form .form-submit {
  display: none;

to this:

Proprietary Software vs. Open Source: the CRM

This is obviously an amazingly large topic, but having recently been forced to increase usability of a business process with a monolithic Constituent Resource Management program (Raiser's Edge) I feel like I need to voice my opinion.  I have been a great fan of Drupal for the past year and my appreciation of the open source nature and ever-changing state of the software is great.  Processes greatly improve over time, the community talks about problems and fixes, and there seems to be a flexible solution for (almost) everything.

Using a nid argument in a block view in Drupal 6

I had a bit of an issue with this since I'm used to using arguments on view pages.  To use node id as an argument with a block view you cannot simple use the "Hide view / Page not found (404)" under "Action to take if argument is not present".  Instead, do the following:

  • Select "Provide default argument" under "Action to take if argument is not present"
  • Select "Node ID from URL"
  • Save your view and include your block on the targetted pages

This way you'll be able to pass the nid argument in your URL to the block view.  Whew!

International Orders with Authorize.net

I recently ran into an issue where international customers could not checkout properly in Ubercart, a fully featured Drupal ecommerce solution.  I was using Authorize.net as the credit card processer.  To allow international customers to be verified with Authorize.net, do the following in your merchant account:

CCK field as a view argument in Drupal 6

I found this trick during the development of Acton Institute's new Drupal-ized website.  I wanted to be able to list out other articles by the same author and show it on a sidebar.  Here's the setup:

  • Article authors are CCK nodereference fields to a separate author content type

How does one then construct a view that thinks the author is a CCK field and not the actual node's author?  It's a lot easier than I thought.  The only thing you need to have in your view is an argument with a little PHP magic.