JuliaKM.com

Drupal

Awhile back, I wanted to add author names to the Drupal search index. After poking around a bit, I found that this was actually pretty easy. I created a new module called custom_helper and in it put the following function:

//Adding author name to the search index
function custom_helper_nodeapi($node, $op, $arg = 0) {
  switch ($op) {
    case 'update index':
      if ($node->uid) {
        $user = user_load(array('uid' => $node->uid));
        return $user->name;
      }
  }

I recently needed to add an extra link to the end of my $items list in a list view and found that this could be done quickly in template.php.

I set out to do two things:
- add a link to the end of my list view that does not contain node data
- as part of this last list item, include a custom link that changes depending on the name of the view

Accomplishing this was a lot easier than I expected. All I had to do was add a switch statement for the view name, and also add a line with the content I wanted to add to my $items array before the theming function.

I recently upgraded this site from Drupal 5.1 to 5.7 on Dreamhost and ran into an odd problem. After upgrading, all of my urls included the path cgi-system. So, instead of my login page being at juliakm.com/user, it was at juliakm.com/cgi-system/user. Because of the url issue, my site lost its theme.

I was banging my head against the wall this weekend trying to remember how to display nodeprofile fields with user information. It's actually really easy and I thought I should write a post about how to do it for the next time I forget.

In this case, I have a content type called 'myuserprofile' that is selected as the content type to use for nodeprofiles. In my myuserprofile content type, I have a field for users to enter their favorite food.

Every once in awhile, when working on a Drupal site, my content either disappears or I cannot log-in. At this point, I usually get rather angry and start thinking of worse case scenarios. What if I can never log into my site again? What if anonymous users can't read articles?

In a rare moment of clarity, I put together the following Drupal permissions debugging checklist. I hope that you find it as useful as I have.

1. Check user access control and make sure that all users can "access content"
Path: mysite.com/admin/user/access

While working on a new Drupal site, I needed to set the same "subsection" template for multiple pages. The site is for an online newspaper and I wanted to use a new template for each of the section homepages. A good example of a similar approach is on CNN.com, where the US section page looks different than both the homepage and the article pages.

PickyRacer.com Up and Running

December 31, 2007

I finally launched PickyRacer.com. PickyRacer is designed to help connect runners with great marathons, half-marathons, and other races. It is built with Drupal 5.3. In the next few months, I hope to add runner blogs, and groups. There are a bunch of other features that I would like to add as well, but I figure I should start small.

Here are some of the more useful modules I used when developing the site:
CCK
Views
Views Bookmarks
Google Analytics
XML Sitemap
Node Teaser
Link
Fivestar
Forward
Location
Node Comment
Path Auto

Figuring out how to get Drupal's imagecache module to work with CCK's imagefield can about as fun as a trip to the dentist. Although I found a lot of articles analyzing the benefits of using Image vs. CCK imagefield, I could not find one source with clear instructions on how to implement imagefield with imagecache. So, here's my stab at an explanation of how to get imagecache to work with imagefield.

One of my first frustrations with Drupal was that I could not seem to get the search module to work. I searched my new Drupal site again and again and was irked to find that each search returned the unhelpful response, "Your search yielded no results."

After searching the forums, I realized out that the search module only works if you have set up a cron job on your server for cron.php. The easiest way to do this via Dreamhost is to go to the control panel (panel.dreamhost.com). Here are the steps to take once there:

Although Wordpress has served me well, I decided that it might be fun to try and rebuild my site using Drupal. For the most part, switching has been easy. I started off with a version on my local computer using MAMP and then transitioned to my Dreamhost account. Dreamhost's databases are slow running Wordpress, and seem to be just as slow running Drupal. But, I didn't expect a speedier site with Drupal.