Drupal Planet

Debug Drush in Eclipse

I've been debugging Drush using Geben on Emacs for a while now, which is a PITA to be honest.  So here's how I finally got XDebug working for Drush in Eclipse. Read more »

Drupal Upgrade vs Migrate

Drupal 7 is just around the corner, and it has such an architectural paradigm shift to make it quite difficult for those trying to upgrade. There are handful of modules which will be deprecated due to changes in architecture (namely fields-in-core).  Content Profile & Ubercart, while not being deprecated, are likely to lose out their new brands Profile2 and Drupal Commerce respectively.  The big dogs CCK, Views, & Panels will likely be delayed on their upgrade paths because of the complexity.  Because of all this, you need to figure out how you're going to be running your upgrade.  There are two possible methods I see, and another method on which I'd like to hear thoughts.

Read more »

Unified content_profile and user page

When you install content_profile, out of the box you have two user profile pages: (1) the drupal core user page (/user/%), and (2) the content-profile node pages (node/%).  These pages don't provide exactly the same information (there's some overlap), which ends up confusing users when they're viewing user profiles.

  Read more »

Proper folder permissions: Drupal & Ubuntu

For some reason, I can't find D.O documentation on the proper folder permissions for Drupal on Linux. So for those of you a-searchin', here's my setup:

Edit: the handbook page is http://drupal.org/node/244924 (from comment), so go there to see alternatives and discussion.

cd /var/www

# u=rwx,g=rx for security
sudo chown -R {username}:www-data .
sudo chmod -R 750 .

# Let apache write to sites/{sitename}/files directories
find . -type d -wholename "*/sites/*/files" -exec sudo chmod -R 770 {} \;

# Make sure newly-created files retain the www-data group (useful for Drush)
# You don't want to apply this to files, only directories.  Hence the round-about method
sudo chmod g+s .
find . -type d -exec sudo chmod g+s {} \;

Installing apachesolr.module on Ubuntu 10.04

Ubuntu 10.04 (Lucid Lynx) just made installing the Apache Solr module for Drupal sooooo much easier. This setup won't work for Ubuntu 9.10 (Karmic Koala), because the aptitude install bit only works for tomcat5.5. If you're on 9.10, check out Nick Veenhof's article. Otherwise, enjoy! Read more »

Determine if current page is a panel (Drupal themes)

Snippet that adds "panels" to the body classes of a page if the currently-viewed page is a panel:

function zen_preprocess_page(&$vars, $hook) {
  $vars['body_classes_array'][] = (module_exists('page_manager') && (page_manager_get_current_page())) ? 'panels' : ''; // Page is Panels page
//  $vars['sample_variable'] = t('Lorem ipsum.');
}

Show "Book Navigation" block only on Book pages

Quickie: Only show Drupal's "Book Navigation" block on Book pages:

1) Go to admin/build/block/configure/book/0
2) "Page specific visibility settings" -> "Show if the following PHP code returns TRUE (PHP-mode, experts only)."
3) Insert the following:

<?php
$is_book
=db_result(db_query('select 1 from {book} where nid=%d',arg(1)));
return
$is_book;
?>

Views 1 API - Adding Relationships in PHP

Views 2 has a great feature called Relationships, allowing your view to aggregate fields from various content types which are related some how. For example, say you have a Person content type and a Dependent content type. Within your view, you might want the Person's first/last name, age, etc.. as well as that person's Dependent's first name. With Views 2, you connect these content types in a view via Relationships and all is dandy. In Views 1 (Drupal 5) however, this is impossible without custom code. Read more »

Views Bulk Operations & Actions (plus configurable secondary page) in Drupal 5

Here's a quick example of writing an Action (5.x-2.x, which is a backport of 6.x's API style) for Views Bulk Operations. It allows you to assign selected users from a view (Usernode) and assign them to selected Organic Groups from a secondary page. Read more »

Syndicate content