drupal

Drupal is a mighty fine Content Management System which we at Leafish both use and contribute to regularly.

This section contains ideas, code snippets and modules which I thought may come in useful for Drupal admins and developers. I won't be officially supporting this code, but feel free to contact me if you have any problems or suggestions.

See also the list of my official projects on drupal.org (requires you to be logged in to drupal.org).

Simple permissions for uploads per node type

19th Aug
2008

Simple bit of Drupal module code from yesterday: permissions are provided for each node type which can have attachments, providing a more granular permission set based on node type. Then, we alter any node add/edit forms and set the #access property for the attachments part of the form based on these new permissions.

Check the code out after the break, hope its of some use somewhere. Does anyone have any thoughts on unsetting form elements like this? Is it a wise thing to do, or is there a better way? Cheers to those who commented, I've modified the snippet accordingly.

Listing authenticated users without roles

1st Jul
2008

Sometimes we'd like to list users who have registered with a Drupal site, but haven't been placed into any proper roles yet via subscriptions, purchases, membership approval or whatever.

Try this join query to get started:

  1. SELECT users.uid, name, created, access, login, status
  2. FROM {users}
  3. LEFT OUTER JOIN {users_roles}
  4. ON users.uid = users_roles.uid
  5. WHERE users_roles.uid IS NULL AND users.uid != 0

On "subscribing" to module porting/updating issues

6th Jun
2008

Come on people, STOP IT! You know who you are. "Subscribing" to an issue on a drupal.org project (can we guess which ones, people?) simply fills the thread full of useless comments, cluttering up any valid discussion enough to make any maintainer cry.

So, again, please stop. Bookmark the issue. Use RSS. Visit the Contributed Module Status group on groups.drupal.org, and help maintain the current branches status list - get some links to the relevant issues in there for us all to "subscribe" to!

And of course, if you really want the issue to enter into your "My Issues" queue, then contribute something more worthwhile than "subscribing" or "..."

/rant

Embedding Views in PHP snippets with Views 2

21st May
2008

Just a quickie - embedding views in PHP snippets etc. Sometimes blocks or panels don't quite cut the mustard and we need to directly insert a view via some PHP.

I started off here - the method I've used before to achieve this. There's another howto on Innovating Tomorrow. However, views_build_view, and indeed theme_view, are both no longer part of Views...

After a bit of searching I found mention of a new function; its also mentioned in the Views 2 documentation (work in progress).

So, the resulting PHP is wonderfully simple:

print views_embed_view($view_name, $display_id = 'default');

I was tearing my beard out, so I hope this helps someone.

6 is the Magic Number

13th May
2008

At last! There were a couple of sacrifices, but I've gone all 6.2! This is the first Leafish site to go live with Drupal 6 (although we do have a big Drupal 6 project in the works) so I've made some notes on the process, and a couple of hurdles I not so much overcame as simply ignored for the time being. Props to all those that have helped get the working modules below up to date.

Resources used:

Read past the break to see how I got on...

Drupal 6 and ting

20th Feb
2008

First up, congratulations everyone on the release of Drupal 6.0! Its a biggy - so many others have already beat me to it listing new features and pointing out some interesting reading involving the release, so I'll not repeat it all over. Here's a few links I found worth a read:

And for those who want to turn their attention to what's in store for Drupal over the next twelve months, development is now open for Drupal 7. Make sure you also take a look at Dries' State of Drupal presentation in Barcelona.

So, as we at Leafish start to play with the latest and greatest release and think about upgrading our sites, our attention shifts from core to contrib... Ooh, the excitement! There's already some early birds and there's certainly some concerns over the state of key modules like CCK, Views and Image.

Last time round for Drupal 5.x I had a whopper of a table which I didn't maintain once sepeck pointed out the fantastic effort Michelle put into a similar list on groups.drupal.org. Once again, there's a pretty comprehensive list over there: check out the Contributed modules status - 6.x page. Its a wiki page, so if you're a module maintainer or are already getting your hands dirty with Drupal 6 patches/ports get updating! And if you're not getting your hands dirty, why not?

Tagadelic for Drupal 6 patch - help test!

18th Feb
2008

jgoldberg, Rob Loach and I have been tweaking a patch to get the Tagadelic module working with Drupal 6.x. We're almost there, so this is a call out to get some more peeps testing before we poke Bèr to get it committed. One down?

Some tweaks for a Drupal WoW guild site

26th May
2007

tempestraidspost.pngThe Tempest is was a World of Warcraft guild site built initially on Drupal 4.7 and recently upgraded to Drupal 5. It provides guild membership management via user accounts and roles, forums with public and private access, raid listings with sign-ups and other groovy stuff like private messaging, image galleries and a links/resources directory.

For managing raids and sign-ups we use a CCK type called 'raid' which includes fields for:

  • Date using the Date API;
  • Instance as a drop-down list (see the attached instance_list.txt for the values we use);
  • Notes for anything else, eg what the goals of the run are.

A slighty tweaked Sign Up module allows guild members to sign-up for raid nodes. We also use the Calendar module along with trusty Views to provide both an Upcoming Raids List and a Raids Calendar.