drupal 7 access callback function

5.1k Views Asked by At

In drupal 7 I'm trying to give permissions of using a node if you are member of the same group as the node.

I want to use hook_menu and define my custom access check function. To this function I sent the nid as a parameter.

This is what I have got now, and I realy don't see why it is not working:

function modulename_pdf_menu() {

    $items['pdf/node/%'] = array(
            'page callback' => '_modulename_pdf',
            'access callback' => '_modulename_pdf_access_check',
            'access arguments' => array(2),         
            'type' => MENU_CALLBACK
    );

    return $items;
}

function _modulename_pdf_access_check($nid) {
 echo $nid;
 die();
}

I assume this should print my node id to the screen and stop. But it is still running the logic defined in _modulename_pdf. Any idea what I'm missing here?

Thanks in advance for your reply.

1

There are 1 best solutions below

1
On

You are right, clear the cache and check it.