new module enabled, but no menu item & no permissions
Hi. First time developing a module. I have a simple module skeleton, adapted from the example in Pro Drupal Development. I save opstatus.info, opstatus.module, and opstatus.admin.inc (shown below). When I refresh admin/build/modules, my module is listed there, and I enable it and save. But that's as far as I get; Drupal doesn't see anything that I've defined in the module:
- My menu item (admin/settings/opstatus) doesn't appear in the Navigation menu, and I don't see it lurking anywhere in admin/build/menu-customize/navigation.
- The permission I created, opstatus_admin_settings, doesn't appear in admin/user/permissions.
I've looked over all of my module code, and I can't figure out what I'm doing wrong. The web server and Drupal logs don't show any errors. All of my module files are world-readable. I've emptied the Drupal cache and rebuilt the menus.
Can someone please point me in the right direction? I'm dead in the water and getting pretty frustrated at this.
Thanks,
Andrew.
opstatus/opstatus.info:
; $Id$
name = "Operating status"
description = "Set the current operating status, for display at the top of each page."
core = 6.x
package = "CDCDC custom modules"
version = 6.x-0.1opstatus/opstatus.module:
<?php
// $Id$
/**
* @file
* Allow CDCDC managers to set the Center's current operating status, to be displayed in a banner at the top of each page.
*/
/**
* Implementation of hook_menu().
*/
function opstatus_menu() {
$items['admin/settings/opstatus'] = array(
'title' => 'Operating status',
'description' => 'Set the current operating status, for display at the top of each page.',
'page callback' => 'drupal_get_form',
'page arguments' => array('opstatus_admin_settings'),
'access arguments' => array('administer operating status'),
'type' => MENU_NORMAL_ITEM,
'file' => 'opstatus.admin.inc',
);
return $items;
}opstatus/opstatus.admin.inc:
<?php
// $Id$
/**
* @file
* Administration page callbacks for the opstatus module.
*/
/**
* Form builder. Configure operating status.
*
* @ingroup forms
* @see system_settings_form().
*/
function opstatus_admin_settings() {
// Form to set the current operating status, as a plain text value
$form['opstatus_current_status'] = array(
'#type' => 'textfield',
'#title' => t('Current operating status'),
'#default_value' => variable_get('opstatus_current_status', t('Open')),
'#description' => t('The status will be shown in the Operating Status banner at the top of each page.'),
);
return system_settings_form($form);
}
figured it out
OK, by walking through the tutorial at http://drupal.org/node/206754 I found that I was missing opstatus_perm(). Once I created that, I was able to use my module.
Shame on Pro Drupal Development (an otherwise solid book) for leaving that out.