Excellent Drupal 7 introduction for experienced developers

Recently, I started working with one of the best Titanium Titans on one of my mobile projects. For those people who aren’t familiar with the concept, Titans in the world of Appcelerator’s Titanium are the thought leaders of the project and, obviously, wicked smart developers. In one of our conversations, he mentioned that a lot of his clients need Drupal expertise and want to use Titanium with Drupal 7, and he asked me about a good introductory book for himself.

My first suggestion was Pro Drupal 7 Development, but after reconsideration, I wasn’t sure if that was the best book to get him familiar with the rich feature set of Drupal. Although it explains the building blocks of Drupal itself very well, it doesn’t provide guidance on the tools, tips & tricks and, most importantly, most used Drupal 7 modules.

For a developer with a pre-existing intermediate to high level of programming expertise who wants to start getting a solid feeling for Drupal 7, I’d recommend Drupal 7 Development by Example instead. I particularly found the discussion of both Drupal basics and ‘must-have’ modules interesting, which of course features the creation of custom content types and a quick introduction to module development, as well as usage examples for modules such as the Media module, Colorbox, Webform, Views, Views Slideshow. Since the book covers a lot of ground, you shouldn’t expect the author to go into too much depth in each area, but anyone looking for a great introduction to the power of Drupal and it’s powerful world of modules, this book is an excellent choice.

 

Drupal Mini Series: Drupal 7 Multi-sites Configuration

If you’ve ever read all the way through a Drupal book, you will have found those short chapters at the end that mention some of Drupal’s more advanced features such as multi-lingual sites. Whenever you setup a Drupal installation that requires the word “multi”, you’d wish that those 2 short pages would be filling a whole book. That’s exactly what Packt Publishing has done with a cool new series called “Drupal Mini Series”: A compact, roughly 100 page long book about a single topic that explains all aspects of it in the level of detail you were looking for.

The first one I read was Drupal 7 Multi-sites Configuration, which explains (in the right level of detail) how to run multiple websites from a single Drupal 7 instance, including the often missing information on server setup, virtual host configuration and how to update a multi-site.

I’ve been a big fan of Packt’s Drupal books for a while; and especially of Matt Butcher. There aren’t that many tech writers out there who can actually explain complicated systems in an easy way. Get your copy here, there are currently two more titles available (Drush User’s Guide and Drupal 7 Multilingual Sites), with hopefully more to come soon.

Installation and Theming for jPlayer for Drupal 6: An HTML5-based mp3 player

One of my clients’ website viewers are moving from desktop to mobile devices. And of course, he is showcasing a lot of music on his website, currently being displayed using a Flash frontend player, which can’t be viewed on iOS devices. To fix that, I recommended switching to jPlayer, a HTML5-based player that uses Flash as a fallback for browsers that don’t support it yet. This post is intended to provide the missing pieces of information for those of us still, ahem, stuck with a Drupal 6 installation (the jPlayer documentation primarily focuses on Drupal 7).

Installation

Here’s a quick overview on how getting jPlayer running on your Drupal 6 installation:

  1. Install Jplayer module for Drupal 6 and enable it like any usual module
  2. Download the jPlayer plugin version 1.2.0 from here or directly here. The most current version (jPlayer 2.0.0) is not compatible with the Drupal 6 jPlayer module. Extract the contents in ‘sites/all/libraries/jplayer’
  3. Go to the configuration page of the jPlayer Drupal module (admin/config/media/jplayer) and specify the path for the jPlayer library as configured above (‘sites/all/libraries/jplayer’)

This should be all that’s involved. You should be good to go to use jPlayer in your content types (select it under “Display Fields” for your content types that have MP3 files uploaded) or use it in Views.

Theming

Of course, it would be great if we could use jPlayer for just any node that has an MP3 file attached to it, either in our theme files or anywhere else we want to manually display an MP3 file using jPlayer. I wasn’t able to find the theming documentation for it on the module page, so here’s a quick code snippet to get you going. For this example, I’m assuming that you have a content type called ‘song’ setup, every song node has 1 MP3 file associated with it.

$nid = 100;                       // Example node id 100
$node = node_load($nid);          // Loading the full song node
$type_name = 'song';              // Machine-name of the node content type
$field_name = 'field_song_file';  // Machine-name of the CCK field you use to store the MP3 file
$jplayer_data = array(
  '#field_name' => $field_name,
  '#node' => $node,
  '#type_name' => $type_name,
  '#theme' => 'jplayer_formatter_single',
  '#item' => $node->{$field_name}[0],
);
print theme('jplayer_formatter_single', $jplayer_data);

Drupal 7 Push Notifications: How to register a device token using services

I recently published a module on drupal.org that allows site admins to send push notifications to users that have registered their mobile device tokens and got asked how users can register a device token. The Push Notifications module for Drupal 7 can be found here: http://drupal.org/project/push_notifications. Here’s a quick tutorial on how to register a token through the services interface.

  1. Navigate to the Services admin interface at admin/structure/services: http://cl.ly/3F1429021N2W2y1s2j15
  2. Add a new services endpoint. For this example, I’m going to create an endpoint called “mobile_data”. This will be the base URL for your services, e.g. http://www.yoursite.com/mobile_data. See http://cl.ly/0j3o0B102j1A1a46183C
  3. You should see your new endpoint listed at admin/structure/services: http://cl.ly/0U0f0p470S1e2J1o0A29. Click on “Edit Resources” for that endpoint
  4. On the “Resource” page for that endpoint, you will see a list of all resources. Make sure “push_notifications” and “create” underneath it is enabled: http://cl.ly/2m0C0Y393y0P2f3L3016
  5. Make sure to enable all parsing types you want, e.g. if you’re sending url-encoded data, make sure it’s enabled: http://cl.ly/1C3K3S3y372o140x1K1c

These are all the steps you need to take to enable your services endpoint. You can then register your device token at http://www.yoursite.com/mobile_data/push_notifications. You should use a POST on that URL and pass two arguments:

  • Token: The device token (argument name: ‘token’)
  • Device Type: The type of the device (argument name: ‘type’, options are either ‘ios’ for iOS devices or ‘android’ for Android devices

A very helpful tool is the Cocoa REST Client.

Picking the best theme for Drupal 7

Just like everyone else these days, I am jumping on the Drupal 7 bandwagon for my newer projects. And every time, I come across the question which theme to use. By default, I gravitate towards Zen. I know it inside out, it is still the most-used theme across all Drupal sites and it just seems like the right way to go. I’m not a big fan of splitting up my css into tens of stylesheets, but I can go with the flow.

Then there is Fusion, which is “a simplified 960px” grid theme and #2 on Drupal.org. As a developer, I often come across these red flags that should be slightly orange ones at best, but I just can’t stop including them into my decision making process. With Fusion, that would be the fact that it is a theme by “Top Notch Themes”. Nothing wrong with that company, but it’s just that: there’s a company behind it that sells most of their other themes. Other than that, it seems to be a perfectly fine theme.

And then there is the new kid on the block: Omega. With a cool name like that, how could you say no (even cooler: the core and starterkit themes are called Alpha and Omega => geek points for that!). Something that I need for my projects is to have most of the configuration to live in the code, not the database, for a lot of reasons other than “versionability”. And from some developer friends, I’ve heard that Omega’s configuration lives mostly in the database. That being said: the usage statistics for Drupal 7 are crazy good: http://drupal.org/project/usage/omega.

The theme package with the fanciest HTML 5 logo is AdaptiveTheme and its numerous sub-themes and sub-themes thereof.

Enough said, let’s get to the trial & switch-to-another-theme part 🙂

Just like everyone else these days, I am jumping on the Drupal 7 bandwagon for my newer projects. And every time, I come across the question which theme to use. By default, I gravitate towards Zen (http://drupal.org/project/zen). I know it inside out, it is still the most-used theme across all Drupal sites and it just seems like the right way to go. I’m not a big fan of splitting up my css into tens of stylesheets, but I can go with the flow.
Then there is Fusion (http://drupal.org/project/fusion), which is “a simplified 960px” grid theme and #2 on Drupal.org. As a developer, I often come across these red flags that should be slightly orange ones at best, but I just can’t stop including them into my decision making process. With Fusion, that would be the fact that it is a theme by “Top Notch Themes”. Nothing wrong with that company, but it’s just that: there’s a company behind it that sells most of their other themes. Other than that, it seems to be a perfectly fine theme.
And then there is the new kid on the block: Omega (http://drupal.org/project/omega). With a cool name like that, how could you say no (even cooler: the core and starterkit themes are called Alpha and Omega => geek points for that!). Something that I need for my projects is to have most of the configuration to live in the code, not the database, for a lot of reasons other than “versionability”. And from some developer friends, I’ve heard that Omega’s configuration lives mostly in the database. That being said: the usage statistics for Drupal 7 are crazy good: http://drupal.org/project/usage/omega.
The theme package with the fanciest HTML 5 logo is AdaptiveTheme (http://drupal.org/project/adaptivetheme) and its numerous sub-themes and sub-themes thereof.
Enough said, let’s get to the trial & switch-to-another-theme part

DrupalCon Chicago

I’m at my first DrupalCon in Chicago. Yeah. Compared to the Drupal Camp in New York, this seems HUGE.
If I actually used Twitter, I should have poster this there. But hey.

New Drupal Module: Privatemsg Bulkmail

One of my favorite modules for Drupal is the Privatemsg module. It’s basically the Drupal version of Gmail, including a huge feature set for (almost) any need. For one of my clients, I needed to create a feature set that allows him to send internal notifications. Although the newest version of the Privatemsg module comes with the feature to send messages to specific user groups (in Drupal talk: roles), that feature didn’t quite fit the required needs, so I decided to write a contrib module with a larger feature-set: Privatemsg Bulkmail.

The Privatemsg Bulkmail module is intended for site administrators who want to send out an identical private message to a large user base (100.000 users and more). An example use case would be an internal notification to all registered users through a private message.

Here’s the description of the feature set:

  • Send out private messages from a specific user (instead of the current user)
  • Define a dedicated bulk message user and prevent that user from logging in (to prevent performance issues)
  • Prevent users from responding to a bulk mail message
  • Include AND exclude recipient group of a bulk mail. Example: Send out a bulk mail to all authenticated users that are not site admins
  • Restrict the recipient group to users who logged in or signed up after a certain date
  • Send an individual test message to a specified user before sending out the bulk mail

If you have a use case for this module, try out Privatemsg Bulkmail and leave some feedback on the issue page.

New Drupal 7 Book: Drupal 7 Module Development

January 7th 2011 was a happy day for all Drupal fans: Drupal 7 got officially released. The two Drupal books that I used to get over the steep learning curve of Drupal 6 module development, Drupal 6 Module Development by Packt Publishing and Pro Drupal Development by Apress, got released for Drupal 7.

While the later is the definite development reference for Drupal, the former was written in a more approchable way. The Drupal 6 version of the book included lots of real-life module examples that made becoming acquainted with Drupal’s API function a fun way to learning module development for Drupal. I can’t wait to work myself through the updated version, “Drupal 7 Module Development“, and will post a detailed review of the book thereafter.

New Drupal Module: Views Search

A feature request for one of my recent projects was an “Advanced Search” functionality, similar to the ones that is commonly found in social networking and personal sites. Rather than creating a completely custom search form using Drupal’s Forms API, I decided to create a module called “Views Search” which uses the Views module and allows anyone to create advanced searches for anything Views can process without custom coding.

Views’ exposed filter work very similar to the search functionality, however exposed filters in the Views module work like true filters, where a list of nodes is limited down to the intended results using a combination of several filters. In contrast to this approach, a more traditional search form allows users to define all criteria first (before seeing any results) and then click on a “Search” button to see the results. This module allows site administrators to easily use the behavior of a traditional search for selected views.

In addition, the Views Search module allows Drupal site members to save their searches for future usage.

Here’s an overview of the feature set:

  • Separates the search form and results: selected views show a search form without showing the results on the first page and the search results without showing the search form/filters on the following pages
  • Allows users to start over with a search (using a button on search results page)
  • Allows users to modify the search criteria (using a button on the search results page that expands search criteria using jQuery)
  • Allows users to save a set of search criteria for later usage
  • Allows users to modify/overwrite the name and search criteria for a saved search
  • Provides a default view that allows the current user to manage saved searches
  • Provides a block showing a drop-down with saved searches for the current user
  • Enables site administrators to select views that should act like “search views”
  • Enables site administrators to limit the number of saved searches for certain user roles & set saved search limits per rule
  • Enables site administrators to batch-delete all saved searches for a specific view

You can download the module from the Views Search Module page on Drupal.org. I’m looking forward to any feedback.

Drupal.org Redesign Imminent

Personally, I’m excited about the upcoming Drupal.org redesign. Not because I think that there is anything wrong with the old design or information architecture – I actually grew to love it. No: I’m mostly excited about the Drupal redesign because I think it will help to push Drupal out of the developer corner and make more people “like” Drupal because of a new design that looks less like a website for geeks only (again: I’m a proud one myself).

Currently, there are some small efforts to make the soon-to-be old Drupal.org look more friendly, but it seems clear to me that a major redesign was needed to communicate the following statement clearly and to the point: Drupal is the most powerful CMS out there.

In my earlier days as a developer, people unsuccessfully attempted to convince me of the power of “Ruby on Rails”. It wasn’t until I started working with Drupal that I found that promised power and ease-of-use, from a developer’s perspective, of course. And that’s the one thing that the current Drupal.org design is not communicating clearly: How powerful Drupal is, how many large organization love it, use it or want to start using it as soon as possible.

In the new design, I too miss the Druplicon looking at me from the top left corner. But I hear Larry in his blog post about the difference between the Druplicon and a logo, and it makes sense to me. One comment in the request to beta-test the new design concerned a lack of character in the new design. While I agree that the new design looks clean but a bit generic, I don’t think the old design had a lot of character because of the visual look of the site itself. The character was coming from the personal involvement of the people using it, and that aspect will continue with the new design

I do think that developers using the Drupal.org issue system will need to adjust to the new look. However, while we will get used to the new look very quickly, Drupal newbies will be much more willing to dive into the beauty of Drupal because of the look of the new website.

Great job!