You are here

Drupal Tutorial

Fixing broken images when Drupal adds _0 to uploaded file names; filename and filepath differs

druplicon.large_.pngOccasionally on Drupal sites (perhaps only Drupal 6), uploading a file to a file field, or the file uploads area on a node, results in the "filepath" indicating a different name than the "filename". That is, in the data model for a Node, you can attach files in the "uploads" or in a CCK field (in Drupal 7 this is slightly different) and each attached file is an object (or array) containing attributes named "filename" and "filepath".

Eliminating duplicates in Views 3 Drupal 6 when the "distinct" and "group by" features don't work

Yes, Drupal 6 is water under the stream except for those of us still maintaining Drupal 6 websites. On one of my sites I'm trying to bring the module status into 2014, because they'd last been updated in 2012 and Views hadn't even been upgraded to Views 3. It was pretty straightforward to generate a Drush Make file to generate updated code for the site. A couple of the Views didn't get properly upgraded to Views 3, and in most cases minor tweaks were all that was needed. But one View had a major flaw - it generated lots of duplicated content.

Fixing things when your Drupal content fields don't display or you can't edit the field

Suppose you've added a field to a Drupal content type, but puzzlingly the field doesn't display on the node edit page? Or the field doesn't display when you view a node? Why would that happen? Maybe, you think, a custom themed node edit page simply didn't display the field? All kinds of ideas might come to mind while you're scratching your head wondering what might be going on. Adding a field to a content type should make it easy to edit and display data in that field, right?

Add a Google CSE to a Drupal 7 site without using google_cse module

The https://drupal.org/project/google_cse module appears to be a dead project - the Drupal 7 port hasn't had any activity in over 2 years. If you want to use a Google Custom Search Engine (CSE) on a Drupal 7 site, what do you do? Turns out it's relatively straight-forward to just generate the CSE over on Google's website, take the code and paste it into a Block, and that's it.

Getting email validation straightened out for successful email transmissions (DKIM, SPF and PTR, oh my!)

One of the things Drupal does is generate emails for a variety of reasons. For example new account registrations include a step to validate the account, by sending an email containing a validation link. On the large online community website I run, a long-running problem has been that the validation email does not always get delivered. This shows up as a user registration that never gets validated.

Generating Apache style .htaccess redirects from Drupal's Path Redirect module

The "Path Redirect" module for Drupal 6 (http://drupal.org/project/path_redirect) is an excellent way to set up redirects from one URL to another. This module can be used for any purpose where you want the HTTP request for URL's on a Drupal website to automatically redirect to another URL. For example :-

  • you might want to have a nice URL to promote for some excellent product (example.com/excellent-camera) that lands on a merchant website while hiding the complexity of the merchant URL (making sure to include the affiliate link).

Make your own tiny URL service in Drupal with Shorten or ShURLy modules

Short (or tiny) URL's are great for sharing links on various social media services. Twitter's 140 character limit places a premium on bytes better used for words than URL's, e-mail clients get hinky with long URL's, and so on. It's possible to use services like tinyurl.com or bit.ly to create your short links, but as Drupal users we have a powerful platform at our fingertips. Maybe it can do the short URL natively or maybe it can be programmed to automatically retrieve short URL's from the existing services.

Make your own tiny URL service in Drupal with Shorten or ShURLy modules

Short (or tiny) URL's are great for sharing links on various social media services. Twitter's 140 character limit places a premium on bytes better used for words than URL's, e-mail clients get hinky with long URL's, and so on. It's possible to use services like tinyurl.com or bit.ly to create your short links, but as Drupal users we have a powerful platform at our fingertips. Maybe it can do the short URL natively or maybe it can be programmed to automatically retrieve short URL's from the existing services.

Configuring Drupal blocks when using the Domain Access module

Following on from my blog post the other day, Looking at (and a debugging tip) the Domain module for Drupal, I want to look at one of the gaps in the Domain Access module. Out of the box it does not modify the blocks configuration pages, meaning that out of the box all configured blocks show up for all domains. This is unlikely to be what you want, instead what's likely is to have different blocks for different domains.

Pages

Short URL