If you create a new node type (e.g. with CCK), and the internal node type contains an underscore, then Drupal internally replaces every '_' with a '-' in the node creation links. If you don't do this, then the postblock link won't work.

Following trivial patch fixes this problem:

--- postblock.module-1.1.2.3	Thu Oct 02 00:40:00 2008
+++ postblock.module	Thu Feb 12 11:51:29 2009
@@ -114,8 +114,12 @@
         break;
     }
   
-    $item->url = url('node/add/' . $item->type, $options);
-    $item->link = l(t('Create a !typename', array('!typename' => $item->name)), 'node/add/' . $item->type, $options);
+    /* Drupal core automatically replaces underscores with hyphens in node type
+       names for node creation links in the navigation block. We also need to do
+       so, or the "Create X" link won't work. */
+    $sanitized_item_url = str_replace("_", "-", $item->type);
+    $item->url = url('node/add/' . $sanitized_item_url, $options);
+    $item->link = l(t('Create a !typename', array('!typename' => $item->name)), 'node/add/' . $sanitized_item_url, $options);
     $vars['items'][] = $item;
   }
 }

Comments

Anonymous’s picture

Status: Needs review » Fixed

Thanks! Fixed in latest version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.