Planet image

The articles on this page are ComputerMinds' contribution to the Planet Drupal aggregated article feed.  Planet Drupal is intended to collate interesting and useful Drupal content from around the web.

Article
Posted on 20th January 2011
Takes about 1 min to read

It used to be a bit of a chore to add a role a user in Drupal, but no longer! All you need to do is this (in Drupal 7): $uid = 123;// User ID of user that you want to add role to. $role_name = 'Role to add'; // The name of the role to add. if ($role = user_role_load_by_name($role_name)) { user_multiple_role_edit(array($uid), 'add_role', $role->rid); } Of course someone can still come along and screw...

Published in: #Drupal Planet #users
Article
Posted on 19th January 2011
Takes about 3 mins to read

Certified to Rock is a site that allows you to look-up Drupal.org user names, and see their 'certified to rock' score. CertifiedToRock.com is a way that community members and employers can get a sense of someone's involvement with the Drupal project. The site uses a custom algorithm that gathers publicly available information which is then distilled down into a score on a scale from one to eleven. I've been wanting to build an easy way...

Article
Posted on 14th January 2011
Takes about 3 mins to read

There are a number of scenarios where you might want to log email being sent by Drupal; perhaps locally during development or for urgent debugging on a live site. There are a number of options available for Drupal email logging, and this article will cover four of the most common ways: Using Devel module. Drupal logging modules: Maillog/Mail Developer, Mail Logger Drupal re-routing modules: Reroute Email, Advanced Mail Reroute SMTP server redirection We'll look at...

Published in: #devel #Drupal Planet #email
Article
Posted on 10th January 2011
Takes about 5 mins to read

What are CTools Dependencies? One of several helpers included in the ctools module, ctools dependency is described on the module page itself as "a simple form widget to make form items appear and disappear based upon the selections in another item". It's designed to make it easy and quick to hide/show form elements based on the value of other form elements in the browser using javascript. This article was written in reference to Drupal 6...

Published in: #ctools #Drupal Planet #Forms
Article
Posted on 25th November 2010
Takes about 1 min to read

There may be better ways to do this, but suppose you want to get Aegir to provision a lot of sites, maybe from a list you've got in CSV file, then you can now use Feeds! The Aegir feeds module exposes the key details to feeds, so that it can create site nodes. Whip yourself up a feed importer preset with the source of your choice, create site nodes and map your values to the...

Published in: #Aegir #Drupal Planet #feeds
Article
Posted on 24th November 2010
Takes about 4 mins to read

Views is the king in Drupal land when it comes to making lists of your data, rightly so, it does a wonderful job of making it easy to choose the data you want to list. It also allows you to render your list in various forms, lists, tables. RSS feeds or even jump menus. So if you want to make a list and render it as CSV or XML, then you naturally turn to views...

Article
Posted on 12th November 2010
Takes about 1 min to read

Facebook is rapidly taking over the planet, and Drupal is arguably trying to do the same. Facebook added the concept of 'liking' a webpage to their array of social tools a while ago. Drupal modules quickly added the ability to 'like' content on your site. This is all well and good, but what about getting some of that data back into Drupal? Suppose that you have an image gallery, and you want people to be...

Article
Posted on 11th November 2010
Takes about 1 min to read

So, it's perfectly valid to visit a site using a URL like: http://www.google.co.uk/////////// But some pesky SEO types will complain that the site is accessible at two URLs and that you need do a 301 redirect to the canonical URL (http://www.google.co.uk/). What you want to do is remove the trailing slashes using mod rewrite. If you really need to do this, then you can just pop the following in the .htaccess file that Drupal provides...

Published in: #Drupal Planet #htaccess #seo
Article
Posted on 11th November 2010
Takes about 1 min to read

Aegir is a system for managing sites using Drupal and drush. We use it to manage this site in fact. However, we use a fairly old version. As a precursor to doing some more work on the backup management I wanted to get my head around the new version of Aegir, and the object orientedness. There's a really useful tutorial over on the Aegir community site: http://community.aegirproject.org/node/75 That shows you how to add options to...

Published in: #Aegir #Drupal Planet #Drupalgive
Article
Posted on 23rd September 2010
Takes about 3 mins to read

If you're using Panels to display dynamic content, you might want to dynamically check whether to display the panes based on what will be shown. For example, if there is no content to show in a certain pane, you probably don't want the pane to show at all. You may especially want to do this if your theme will do anything ugly, or just unnecessarily conspicuous, with any HTML that is wrapping empty content. By...

Published in: #Drupal Planet #Panels