case :

  1. I have created a custom module

  2. Implemented a hook_menu() as shown

function my_custom_menu() {

  $items = array();
  $items['my/custom/link'] = array(
    'title' => t('My Custom Form'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('my_custom_user_form'),
    'access arguments' => array('access content'), 
    'access callback' => TRUE,  
    'type' => MENU_NORMAL_ITEM,
    return $items;

But problem is that "anonymous users not able to access link"

Please guide me...

  • Try removing the access arguments and flushing all caches. Jul 13, 2015 at 13:58

3 Answers 3

$items['your/menu/link'] = array(
    'title' => t('Your menu Title'),
    'page callback' => 'your_callback_page',
    'access arguments' => array('your arguments access'),
    'type' => MENU_LOCAL_TASK,
    'weight' => -1, // as per your requirment

I would suggest you gain more control over the access, by switching to "access callback" => "my_custom_function".

Then in my_custom_function() you can write just "return true" which will make it always accessible.

You could also add a log before "return true" so you can tell whether the function is being called. If it isn't, then you know access is being blocked further up, before you get to that stage.


If the link is meant to be accessible by everyone then you can remove 'access arguments' from the array. Also change 'type' to MENU_CALLBACK. Finally, clear the caches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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