Problems with hook_menu() not registering

IceCreamYou - January 5, 2009 - 04:43

Hello. I'm building a module called user_deco, and none of my menu items are registering with the system. I've built two other modules where hook_menu() works, and I've basically just copy-pasted from them, but it still doesn't work for user_deco. I have thoroughly cleared my caches.

Here's the hook:

<?php
/**
* Implementation of hook_menu().
*/
function user_deco_menu($may_cache) {
 
$items = array();
  if (!
$may_cache) {
   
$items[] = array(
     
'path' => 'admin/settings/user_deco',
     
'title' => t('Deco settings'),
     
'description' => t('Adjust settings for user_deco.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_admin',
     
'access' => user_access('access administration pages'),
     
'type' => MENU_NORMAL_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/gallery',
     
'title' => t('Deco Gallery'),
     
'description' => t('Shows a gallery of user_decos with the option to buy them.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'gallery',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_DEFAULT_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/mine',
     
'title' => t('My user_decos'),
     
'description' => t('Displays decos the current user has bought.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'mine',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/added',
     
'title' => t('My Added Decos'),
     
'description' => t('Displays decos the current user submitted.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'added',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/flagged',
     
'title' => t('Flagged Decos'),
     
'description' => t('Displays decos that have been flagged as inappropriate.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'flagged',
     
'access' => user_access('admin user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/add',
     
'title' => t('Add Deco'),
     
'description' => t('Allows users to add a deco to the system.'),
     
'callback' => 'user_deco_add',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/flag',
     
'title' => t('Flag Deco'),
     
'description' => t('Flags a deco for administrative review.'),
     
'callback' => 'user_deco_flag',
     
'access' => user_access('flag user_decos'),
     
'type' => MENU_CALLBACK,
    );
   
$items[] = array(
     
'path' => 'user_deco/buy',
     
'title' => t('Buy Deco'),
     
'description' => t('Adds a deco to a user and subtracts userpoints.'),
     
'callback' => 'user_deco_buy',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_CALLBACK,
    );
   
$items[] = array(
     
'path' => 'user_deco/remove',
     
'title' => t('Remove Deco'),
     
'description' => t('Removes a deco from a user and refunds userpoints.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_remove',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/delete',
     
'title' => t('Delete Deco'),
     
'description' => t('Deletes a deco from the system and refunds userpoints.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_delete',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/clear',
     
'title' => t('Clear Flags'),
     
'description' => t('Clears flags from a deco.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_clear',
     
'access' => user_access('admin user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
  }
}
?>

Thanks!

Be sure to return the

nickurbits - January 5, 2009 - 04:51

Be sure to return the variable!

<?php
function user_deco_menu($may_cache) {
 
$items = array();
  if (!
$may_cache) {
   
$items[] = array(
     
'path' => 'admin/settings/user_deco',
     
'title' => t('Deco settings'),
     
'description' => t('Adjust settings for user_deco.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_admin',
     
'access' => user_access('access administration pages'),
     
'type' => MENU_NORMAL_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/gallery',
     
'title' => t('Deco Gallery'),
     
'description' => t('Shows a gallery of user_decos with the option to buy them.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'gallery',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_DEFAULT_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/mine',
     
'title' => t('My user_decos'),
     
'description' => t('Displays decos the current user has bought.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'mine',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/added',
     
'title' => t('My Added Decos'),
     
'description' => t('Displays decos the current user submitted.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'added',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/flagged',
     
'title' => t('Flagged Decos'),
     
'description' => t('Displays decos that have been flagged as inappropriate.'),
     
'callback' => 'user_deco_gallery',
     
'callback arguments' => 'flagged',
     
'access' => user_access('admin user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/add',
     
'title' => t('Add Deco'),
     
'description' => t('Allows users to add a deco to the system.'),
     
'callback' => 'user_deco_add',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_LOCAL_TASK,
    );
   
$items[] = array(
     
'path' => 'user_deco/flag',
     
'title' => t('Flag Deco'),
     
'description' => t('Flags a deco for administrative review.'),
     
'callback' => 'user_deco_flag',
     
'access' => user_access('flag user_decos'),
     
'type' => MENU_CALLBACK,
    );
   
$items[] = array(
     
'path' => 'user_deco/buy',
     
'title' => t('Buy Deco'),
     
'description' => t('Adds a deco to a user and subtracts userpoints.'),
     
'callback' => 'user_deco_buy',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_CALLBACK,
    );
   
$items[] = array(
     
'path' => 'user_deco/remove',
     
'title' => t('Remove Deco'),
     
'description' => t('Removes a deco from a user and refunds userpoints.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_remove',
     
'access' => user_access('buy user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/delete',
     
'title' => t('Delete Deco'),
     
'description' => t('Deletes a deco from the system and refunds userpoints.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_delete',
     
'access' => user_access('add user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
   
$items[] = array(
     
'path' => 'user_deco/clear',
     
'title' => t('Clear Flags'),
     
'description' => t('Clears flags from a deco.'),
     
'callback' => 'drupal_get_form',
     
'callback arguments' => 'user_deco_clear',
     
'access' => user_access('admin user_decos'),
     
'type' => MENU_DYNAMIC_ITEM,
    );
  }
  return
$items;
}
?>

Thanks

IceCreamYou - January 5, 2009 - 04:52

Oh, wow, I knew it would be something dumb like that. Thanks so much.

 
 

Drupal is a registered trademark of Dries Buytaert.