0
function updatable_news_menu() {
    $items['updatable_news/test'] = array(
        'title' => 'Updatable news',
        'page callback' => 'updatable_news_test',
        'access callback' => 'updatable_news_permission',
        'access arguments' => "hello",
    );
}
function updatable_news_permission() {
    return true;
}   

I have used a similar implementation and the permission is ok in another module. However, it fails in this module which defined a brand new entity.

function updatable_news_menu() {
    $items['updatable_news'] = array(
        'title' => 'Updatable news root',
        'page callback' => 'updatable_news_root',
        'access arguments' => true,
    );
}

I have to add new menu item with access should always be true. But it only succeed for administrator instead of anonymous user and logged in user.

2
  • 1
    Take a look at the very end of your hook_menu implementation - is anything missing? Also check the var type of access arguments against the documentation
    – Clive
    Mar 14, 2014 at 10:24
  • Gisle Hannemyr-thank you for your help,for first question,I forget to return the menu,and secondly,the 'access arguments'=>true should be 'access callback'=>true.(it is the main reason for my problem)
    – Jeff Chung
    Mar 15, 2014 at 2:21

1 Answer 1

1

'access arguments' must be an array. Like 'access arguments' => array('access administration pages')

1
  • Yes, this is correct, access arguments is an array of args passed to the access callback. Note also, to bypass the access check you use access callback => TRUE not access arguments => TRUE Mar 15, 2014 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.