Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
menu system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Sep 2007 at 15:54 UTC
Updated:
26 Sep 2007 at 16:01 UTC
Hi,
As I learnt in #178138, when writing my own content node type in a module (this case in 'faq'), I shouldn't define anything in hook_menu() for "node/add/faq". Instead it's automatically generated and I was advised to use hook_menu_alter() if I wanted to change anything for it. I want to change the access to "create faq". I'm trying the code below:
function faq_menu_alter(&$callbacks) {
$callbacks['node/add/faq']['access callback'] = "user_access";
$callbacks['node/add/faq']['access arguments'] = "create faq";
}
However, after adding in this function I get the error below on "node/add/faq":
warning: Invalid argument supplied for foreach() in /var/www/drupal_6.1_20070924/html/includes/menu.inc on line 258.
I've looked at the api docs which haven't really helped and I couldn't find any examples or useful references.
All help appreciated.
Thanks,
Stella
Comments
Comment #1
stella commentedooops, my bad, I should have set the access arguments to be
array("create faq"). Sorry.Cheers,
Stella