To override existing menu items you need to use hook_menu_alter()
instead of hook_menu()
. e.g.
function proposals_menu_alter(&$items) {
$items['node/add/proposal']['access callback'] = 'some_function';
}
But there's also hook_node_access()
which would be preferable to use for (as the name suggests) checking node access. e.g.
function proposals_node_access($node, $op, $account) {
$type = is_string($node) ? $node : $node->type;
if ($type == 'proposal' && $op == 'create') {
if ($allow_access) {
return NODE_ACCESS_ALLOW;
}
else {
return NODE_ACCESS_DENY;
}
}
return NODE_ACCESS_IGNORE;
}
Assuming you populate $allow_access
with your access check. Be sure to use the $account
object that's passed to the hook to verify the operation against that user object. Don't depend on the currently logged in user, which will not always be the same.