twominutes module - Access Denied [Solved]
I was getting an "Access denied - You are not authorized to access this page." error after trying to access the twominute-page module.
twominute.info:
name = Two Minute Module
description = "Demo of how quickly you can build a single module."
package = Build a Module
core = 7.x
files[] = twominutes.module
twominute.module:
<?php
/**
* Implements hook_menu().
*/
function twominutes_menu() {
$items['twominutes-page'] = array(
'page_callback' => 'twominutes_page',
'access_arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function twominutes_page() {
return "Hello world!";
}
Thanks to Chris for helping me out with this one.
The problem is that you've used underscores in your hook_menu property names. For example, "page_callback" should be "page callback".
Removed the underscores from page callback and access arguements.
'page callback' => 'twominutes_page',
'access arguments' => array('access content'),
I wanted to post this in case anyone else has the same issue.
Thank you for posting this!
Cheers,
Chris