Skip to main content

drupal 7

Add New Version of jQuery to Drupal 7 Theme

Today I needed to add the newest version of jQuery (1.7) to a custom Drupal 7 theme that I was building. I initially used the jQuery Update module and hacked the replaced version of jQuery with the version I needed. I know, this was not the best practice, but this was a rush job and I was in a hurry (don't hack the core, or any contributed modules for that matter!). Everything was working fine until I wanted to add a new field to a content type and the form quit working in the admin overlay, which was using the Seven theme. Crap!


Views menu tab displayed on only certain content types.

I recently ran into an issue where I wanted to use a views page as a tab for nodes of type 'course'. I added the view page like normal, providing my path of: node/%/course-list.

Next, I added my menu item entry as a 'menu tab'.

Perfect, except that the menu tab was displaying on every node when I needed it to only display on one node type.


Drupal Calendar: Use a Drop Down Menu to Change Calendar Dates

We had a Drupal 7 site setup with a default calendar instance that was displaying content of type 'event'. Due to the limited number of events this site would promote, it was decided to change the navigation from the standard 'Next/Previous' to use drop down menus where the user could choose the month/year they wanted to view.

The original look


Drupal Book Permissions: Only Let Users Add Content to their Own Books

Today's project required me to fine tune Drupal's standard book module. Basically, I needed to limit the choices in the 'Book Outline' area to only display books that the user was the author of. Unfortunately, Drupal's default permissions don't allow for this. Either the user can administer all outlines or none, nothing in between.


How to add a class to a Drupal 7 region

Today I needed to add a class to a Drupal 7 region and found the lovely template_preprocess_region() function to do the dirty work for me. With this function, you can easily add any class to your regions with the code below.

In a nutshell, you find the region you want to add the class to and then append your class onto the end of the classes_array variable.


Having a node's field show in a block region.

I'm currently building a website that has a three columned layout. The left most column contains the navigation elements, the center column contains the body, and the right side column contains supporting text for the article. So I created three block regions in my theme: left_sidebar, content, and right_sidebar. The problem I ran into was that the text in the right side column was different for every node. Having the user create a separate block for each node seemed very inefficient.


Drupal 7: Feeds Import: Generating the correct .csv

Today I needed to import about 2000 user accounts into a new Drupal 7 database. To do this I decided to use the Feeds module which includes a Feeds Import module. Perfect! First, I went to the feeds admin interface and setup the import by mapping all of my fields to the .csv. Next, I opened Excel and generated my spreadsheet. Once that was completed I saved the spreadsheet as a .csv file and tried to import. The form returned with the following message "0 users created". WTF!