I'm not sure if i can post this here, but because the modules section is highly visited, and i guessed that alot of you have read the Pro Drupal Development book, i thought i might post it here. I followed the exact instructions and code that given till then. At page 19 you should be able to access the admin/settings/annotate menu-page. But i dont see 'annotate' anywhere in the 'site configuration' list and when i go there directly by url it says:
Access denied
You are not authorized to access this page.

Anyone encountered the same problem? Or is it just a typo? I'm pretty much stuck at this point. Very frustrating.

Thanks in advance,
Danny

Comments

bcn’s picture

Maybe post your code, so we can see what you got...

danny_joris’s picture

I forgot to say that the book is the second edition (6.x).

annotate.module

<?php
// $Id$
/**
 * @file
 * Lets users add private annotations to nodes.
 *
 * Adds a textfield when a node is displayed
 * so that authenticated users can make nodes.
 */

/**
 * Implementation of hook menu
 */
function annotate_menu() {
	$items['admin/settings/annotate'] = array(
	'title' => 'Annotation settings',
	'description' => 'Change how annotations behave',
	'page callback' => 'drupal_get_form',
	'page arguments' => array('annotate_admin_settings'),
	'type' => 'NORMAL_MENU_ITEM',
	'file' => 'annotate.admin.inc',
	'access' => user_access('administer site configuration')
	);

	return $items;

}

annotate.admin.inc

<?php
// $Id$
/**
 * @file
 * Administration page callbacks for the annotate module.
 */

/**
 * Form builder. Configure annotations
 *
 * @ingroup forms
 * @see system_settings_form().
 */
function annotate_admin_settings() {
	// Get an array of node types with internal names as keys and
	// "friendly names" as values. E.g.,
	// array('page' => 'Page', 'story' => 'Story')
	$options = node_get_types('names');

	$form['annotate_node_types'] = array(
	'#type' => 'checkboxes',
	'#title' => t('Users may annotate these content types'),
	'#options' => $options,
	'#default_value' => variable_get('annotate_node_types', array('page')),
	'#description' => t('A text field will be available on these content types to make user-specific notes.'),
	);

	return system_settings_form($form);
}
prakashp’s picture

1. Make sure you have the 'administer site configuration' permission.

2. Clear the cache. (Administer >> Performance > 'Clear Cache Data')

bcn’s picture

Have a look at this function:

function annotate_menu() {
$items['admin/settings/annotate'] = array(
'title' => 'Annotation settings',
'description' => 'Change how annotations behave',
'page callback' => 'drupal_get_form',
'page arguments' => array('annotate_admin_settings'),
'type' => 'NORMAL_MENU_ITEM',
'file' => 'annotate.admin.inc',
'access' => user_access('administer site configuration')
);

Looking closely, I see that this:
'access' => user_access('administer site configuration')

should be:
'access arguments' => user_access('administer site configuration')

The rest of it looks ok, so I bet that is the problem. Can you tell us if that error is present in the book too?

EDITED (to add):
I just tried this out, and while the annotate admin settings page now shows, I'm getting some php errors so I'm not exactly sure what's wrong...

danny_joris’s picture

Yes, this modification gives errors.

Thanks for your help, but i figured it out. I'm not going to type from the book anymore. I found the right files that comes with the book at http://www.drupalbook.com/node/2 . I guess i didnt have enough sleep yesterday because i downloaded the first edititon files instead of the second edition. It all works now.

Cheers,
Danny