Skip to main content

Secondary links displaying on the home page

In a recent project I needed to have my secondary links display on the home page, but for some reason they weren't displaying. I had the source for the secondary menu set in the menu settings to be the 'main menu' and my 'main menu' was setup like this:

  • Home
    • Sub 1
    • Sub 2
  • Nav 1
  • etc.

My 'Home' link's href was set to <front> and the secondary links worked perfectly, except on the home page.


Drupal Context Module

Today I was researching some modules for a large project that I am working on and I came across the Context module. This module allows you to setup different conditions and add/remove content from the theme. For example, if I wanted an entire block region removed from a members only region of my site, I would setup my condition to be 'intranet*'. Then, I would set my 'Reactions' to remove the proper template regions from the theme.

Pretty badass!. I'm going to continue learning about this, and will post more as I get deeper into the build of this new project.


Restoring EBS Snapshots for Backup Restore

Today I had the unfortunate need to get a restored database from an Amazon EBS snapshot. To do this I logged into the Amazon AWS management console and determined which snapshot I needed to restore from. Once I highlighted the correct snapshot, I clicked the 'Create Volume' button. Next, I chose which availability zone the snapshot should reside in and click 'Create'

Next, I spun up a new instance of the production server, using the same AMI (ami-294aa340). Once the new instance was created, I attached the volume I created above to the instance and logged into the server.


Using Ubercart's hook_product_description_alter() function to Update the cart_view_form and cart_checkout_form

I'm in the process of building a custom Ubercart module that allows users to dynamically enter sizes using Ubercart's uc_attributes module. The problem I ran into is that I needed to theme these custom attributes in the cart_view_form and cart_checkout_form to add a suffix behind value. Initially I overwrote the original theme file in my module using the phptemplate_ prefix. This worked great, however, after further consideration I realized the flaw in this logic. Overriding the theme like this would not allow other user's to override that theme file. So back to the drawing board I went.


MySQL Auto Updating Timestamps

Today I was working with an ExpressionEngine website (which I know nothing about) and I needed to get a modification date on the user profile fields. After searching the ExpressionEngines documentation, I realized that adding my own submit function wasn't going to be as easy as Drupal's hook_form_alter(). My next thought was to try MySQL. After searching a little, I found a post that showed me how to add a timestamp field that updates automatically (http://richard-quinn.net/?p=114).


Setting Dynamic Views Filters With Drupal Using hook_views_query_alter()

Today I had the challenge of generating a view that needed to filter results based on the date/time a node was created. More specifically, I needed to filter bowling stats for a season. Easy, right? The problem I ran into is that the bowling season doesn't begin and end in the same year. So using an argument to only grab nodes created in 2011 didn't work. I needed the view to grab nodes between July, 2010 through July, 2011.