0
votes

Using the following code:

function mymodule_menu_alter(&$items) {
    if (isset($items['node/add/page'])) {
        $items['node/add/page']['access arguments'] = FALSE;
    }
}

I get the following error:

warning: Missing argument 1 for node_access() in /var/www/vhosts/mysite.co.uk/httpdocs/modules/node/node.module on line 2011.

The code actually works and does what I need it to do but the error concerns me and confuses my site users.

I am not sure what the issue is or how to resolve it. Can anyone offer some assistance?

1

1 Answers

2
votes

access arguments needs to be an array:

function mymodule_menu_alter(&$items) {
  if (isset($items['node/add/page'])) {
    $items['node/add/page']['access arguments'] = array();
  }
}

If you're trying to deny access to your page to absolutely anyone you should use the access callback key instead:

function mymodule_menu_alter(&$items) {
  if (isset($items['node/add/page'])) {
    $items['node/add/page']['access callback'] = FALSE;
  }
}