Drupaler.co.uk

Syndicate content
Updated: 26 min 24 sec ago

Missing Anonymous User

5 hours 18 min ago

I've spent the last few days wrestling with an evil bug. I had a content type, called Card, which I could create fine when logged in as any authenticated user of any role. All cool. I should also be able to create this content as anonymous.

Indeed, going to Create Card (node/add/card) was fine. I got the form, filled it in, but then nothing. Page Not Found where the created node was expected. The node simply wasn't created! But there were no warnings or errors. Big fat nada.

read more

Categories: Planet Drupal

Counting Hooks

November 17, 2009 - 11:02

This (fairly long) one-liner counts the number of implementations of each hook in your Drupal installation:

ack "Implements? hook_" | perl -e 'while (<>) { m[(hook_\w+)] and $hooks{$1}++; } foreach (keys %hooks) { print "$_ - $hooks{$_}\n"; }'

To count only install file hooks, which was what I was doing, give ack the option "-G '.install'" thus:

ack "Implements? hook_" -G '.install' | perl -e 'while (<>) { m[(hook_\w+)] and $hooks{$1}++; } foreach (keys %hooks) { print "$_ - $hooks{$_}\n"; }'

read more

Categories: Planet Drupal

Six Reasons To Get A Handbook Page For Your Module

November 6, 2009 - 08:56

Checkout view being currently disabled in ViewVC is a very good opportunity to remind everyone that linking to your README.txt file in CVS does not count as documentation on your project page!

Here are some things I, or anyone else, can do with a proper documentation page in what used to be called the handbooks section of drupal.org:

  • Correct it.
  • Expand on it.
  • Clarify things for newbies.

read more

Categories: Planet Drupal

Nodes As NIDs

November 4, 2009 - 15:41

Is it just me who finds this poor style and potentially confusing:

<?php
function my_function($nodes) {
  foreach ($nodes as $nid) {
    // do stuff
  }
}
?>

To me, a variable names $nodes will be an array of nodes -- that is, node objects. If it's an array of nids, I would call it $nids to avoid confusion about what we have there.

I'm curious if other people agree (in other words, is it worth my time writing a patch for core or will it just lead to bikeshedding?)

read more

Categories: Planet Drupal

Creating A Set Of Fields In One Swell Foop

November 4, 2009 - 15:19

Situation: you need a heap of imagefields that more or less have the same setup. Let's not go into why.

You could spend half an hour bored witless clicking through the interface.

Or you could create just the one field, export the content type with content copy, and then doctor the code a little before importing it back in. Like this....

<?php
// The usual content type stuff here.
// Set of image fields
$image_fields = array(
'field_image_1' => 'Image 1',
'field_image_2' => 'Image 2',
// etc
);

foreach ($image_fields as $name => $label) {

read more

Categories: Planet Drupal

The Contrib Conundrum

October 30, 2009 - 14:13

Edit: Please read this blog post, but also please jump in on this thread - the idea is already proposed but needs community support:
http://drupal.org/node/484034

And so again today it happened, as it does so many days. Someone needs to be able to do something. They Google. They search Drupal.org. They find nothing but a few open issues or an unsuitable/unsupported contrib module. They're a developer, so after an hour of searching they think "ach, to hell with this - I'll just write something".

read more

Categories: Planet Drupal

Translation: Proving Complicated

October 27, 2009 - 11:50

Editor's note: Joachim appreciates this may be a bit of a rant, and hopes people who read this and know more about the translation of Drupal than he will contribute via the Comments and tell him why he's being an idiot. But we decided to run with it because he makes some really valid points. I don't know if the translation interface was a part of the UI work for Drupal 7, but reading Joachim's experiences, I would hope so!

Rant starts here:

read more

Categories: Planet Drupal

Small Core, Big Drupal, Tighter Contrib: Outer Core?

October 18, 2009 - 11:09

I've been mulling this idea since Paris, trying to figure out the best way to present it.

But basically:

We want a smaller, slimmer, efficient core.
But we also want Drupal to, like, be useful.
We want contrib, at least the high-use end of contrib, to be smoother, more organized, released on time with core.
It's been suggested we have a contrib maintainer, who would have the unenviable task of managing a huge kaboodle.

read more

Categories: Planet Drupal

Altering A Views Query: Tackling The Node Type Filter Bug

October 12, 2009 - 17:53

I happened across a wee bug in Views 2 today. I think I've noticed it before, and I'd be a monkey's uncle if it isn't already in the queue, but this is a synopsis:

If you expose the Node Type filter in Views 2 and set it to "Optional", but also with "Limit list to selected items" checked, you might expect it to continue to restrict the results to the selected items it refers to, right? (Well I did.) It does not. If your use selects the "< Any >" option from the resulting UI they will get *everything*

Doh!!

read more

Categories: Planet Drupal

Cleaning Up Node Edit Forms

October 12, 2009 - 09:16

Every time you build a new application in Drupal you *always* have to carefully govern the number of options available to normal site editors, or their heads will explode. (Literally. I've seen it.)

Almost every module you install will put something more on the node forms, until you end up scrolling forever just to reach the Save button. Not to mention most of this stuff you won't want them playing with anyway.

read more

Categories: Planet Drupal

Drupal 6.x And Ubuntu 8.04 (Hardy)

October 5, 2009 - 08:56

A few weeks ago I wrote a post about how to bring a stock CentOS 5 server up to spec to run Drupal 6. It seems only fair I do the same for Debian and Ubuntu, since it seems they too are not without their little issues when a stock install. This quick post was written after configuring a server running Ubuntu 8.04.2 (or Hardy Heron, as it was codenamed).

The first (and main) problem with a stock Debian install is it does not include the necessary GD support for manipulating images. There is a long internal squabble in the Debian ticketing system here:

read more

Categories: Planet Drupal

Do We Have To Put Corks On All The Knives?

October 4, 2009 - 11:54

Yay! My first blog post with the 7.x tag! It's coming up fast, folks... Shame this one is a gripe.

Courtesy of an issue I raised some months back regarding the update system registering updates in the system table, even if they fail, I came across an interesting and (IMHO) bad decision regarding update.php in Drupal 7:
http://drupal.org/node/595550

read more

Categories: Planet Drupal

Sometimes The API Just Won't Do It

October 2, 2009 - 22:30

So I've been having lots of fun (read: horrible pain) this week thanks to some quirks of Drupal that only really present themselves when you are looping through, loading, saving and manipulating nodes quickly. The scenario for this sort of thing is normally (yup, you've probably guessed it) importing.

read more

Categories: Planet Drupal

Theming Ubercart, Some Tips And Tricks

September 18, 2009 - 11:29

First, a note on "compatibility" (for want of a better word). This piece is written after some extensive theming work in Ubercart 5.x-1.7. Much of this is still useful information for the Drupal 6.x version of Ubercart, but it may not be wholly accurate.

I should also note that this is not really a hand-holding step-by-step piece. It's more for people who are already pretty familiar with theming Drupal and just want to know where to look.

read more

Categories: Planet Drupal

Drupal 6.x And CentOS 5.x

September 9, 2009 - 11:07

This is more a bookmark for my reference than anything, but if you have a stock CentOS 5.x installation (maybe from a VPS image or a clean install on a dedicated box) you're going to have issues with Drupal 6.x.

It comes down to PHP version. It ships with PHP 5.1.6 and Drupal these days pretty much depends on PHP 5.2.x upwards to work. Utilities like Drush do too, so leaving PHP as it is, you'll find, is not really an option. To confirm you will have this problem, execute this command to check your PHP version:

$ php -v

read more

Categories: Planet Drupal

Framework, Product Or Both?

August 31, 2009 - 11:38

Ask any Scottish whisky maker, distilling is not an easy process. Only when the hot gases cool can you see the real results of your labours. And (in the case of whisky, at least) you often have to leave the resulting liquids to sit for a long time, observing them carefully and testing them regularly, to get a really perfect product at the end.

read more

Categories: Planet Drupal

This Author Sees A Long Drupal Slope

August 28, 2009 - 10:11

I'm prompted to write a post that is a bit less technical and more of a muse on the state of the Drupal project. Anyone who follows the community will know much is made of a developer/designer divide. To be honest, I still don't quite get why this is. I don't personally feel it.

read more

Categories: Planet Drupal

Never Write A Line Of Code Again!

August 18, 2009 - 09:21

Okay, so I lied. But module builder can save you a lot of time when writing custom modules.

And it now works with drush, too. I added support for drush a few weeks ago, which let you do things like "$ drush mb mymodule cron init menu nodeapi --write" and hey presto, a new module folder is created, with an info file and a module file, with hook implementations ready to do your (evil) bidding. (Note: this blog does not sanction use of Drupal, module builder, or drush for evil.)

read more

Categories: Planet Drupal
 
 

Drupal is a registered trademark of Dries Buytaert.