0

I want all the users to access the custom defined url. But now I got error message as Access Denied, my code is as follows, I tried clearing both drupal and browser cache. Please help me,

function hbrowse_menu() {
  $items = array();
  $items['browse/restaurants'] = array(
    'title' => t('Browse Restaurants'),
    'page callback' => 'list_restaurants',
    'access arguments' => array('access content'),
    'access callback' => TRUE
  );
  $items['browse/cuisines'] = array(
    'title' => t('Browse Cuisines'),
    'page callback' => 'list_cuisines',
    'access arguments' => array('access content'),
    'access callback' => TRUE
  );
  return $items;
}

hbrowse is my module name.

2 Answers 2

2

Just remove access arguments, when the callback is set to TRUE you dont need any parameters:

$items['browse/restaurants'] = array(
  'title' => t('Browse Restaurants'),
  'page callback' => 'list_restaurants',
  'access callback' => TRUE,
);
2
  • Thanks @Strae it's working now. I deactivated the module, cleared the cache and activated again. Before doing that it wasn't working. Thanks for help. Sep 12, 2013 at 6:21
  • Always clear the cache when working with drupal ;)
    – Strae
    Sep 12, 2013 at 7:17
0

Try using

  $items['browse/restaurants'] = array(
    'title' => t('Browse Restaurants'),
    'page callback' => 'list_restaurants',
    'access arguments' => TRUE,
  );
2

Your Answer

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

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