I am working on a drupal 6.x module which consists of several page as defined in the .module page. The problem is that when I visit those pages as admin, I get access denied. I thought that admin (user 1) could access anything? Here the code for some of the pages:
function foobar_menu()
{
$items['admin/foobar'] = array(
'title' => 'administer foobar',
'page callback' => 'foobarpage',
);
$items['admin/foobar/baz'] = array(
'title' => 'Do baz',
'page callback' => 'drupal_get_form',
'page arguments' =>array('foobarpage'),
);
So how do I make sure that only admin can see these pages and the rest get a “page does not exists” error?
EDIT: I found solution here.
You need to define
access argumentsfor every single menu item.See drupal.org documentation on this subject.
For example you hook_menu may look something like this: