1

Can someone see anything wrong with this hook_menu() and hook_permission() code? I am able to see the permissions in the admin menu, admin/people/permissions. I allow access to los user front for authenticated users and save the settings. Then, I clear all caches and try to access los/register. I am getting You are not authorized to access this page. when I try with either administrative or authenticated users. I have cleared the cache, logged in and out and even closed the browser and restarted it refreshing ever step of the way.

/**
 * Implements hook_permission
 */
function los_permission() {
  return array(
    'los user front' => array(
      'title' => t('LOS User Frontend'),
      'description' => t('Access to LOS user frontend.'),
    ),
    'los user back' => array(
      'title' => t('LOS User Backend'),
      'description' => t('Access to LOS user backend'),
    ),
    'los admin back' => array(
      'title' => t('LOS Administration Backend'),
      'description' => t('Access to LOS administration backend.'),
    ),
  );
}

/**
 * Implements hook_menu
 */
function los_menu() {
  $items = array();

  $items['los/register'] = array(
    'title' => 'LOS Register',
    'description' => 'Large order system registration page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('los_register'),
    'access arguements' => array('los user front'),
  );

  //... more $items here ...

  return $items;
}
  • I think this question has proven to be useful as it has a very high view rating, has been added to favorites and up-voted. I think it is very applicable and should be reopened. – Brandon Bearden Aug 11 '14 at 22:56
3

It's access arguments not access arguements :)

  • Well that was just dumb of me. Thank you for your quick answer! On a follow up... do you know what permissions you would set if for a hook_menu() item that was to be used by a script or an AJAX call? – Brandon Bearden Aug 18 '12 at 18:48
  • we've all been in typoland before so all good. as to your followup question, that all depends on who/what you want to grant access to the menu item like you would any other. – Jimajamma Aug 18 '12 at 19:10
  • Okay, so I guess that is what I do not understand. How to limit "what" can access a page. I do not want anyone to be able to browse to los/register/ajax, for example, but I want to be able to do an ajax call to that page. Maybe this is not an ideal way to think about it. – Brandon Bearden Aug 18 '12 at 19:13
  • 1
    that's a whole 'nother question to be asked – Jimajamma Aug 18 '12 at 19:20
  • Here is the question: drupal.stackexchange.com/questions/40202/… – Brandon Bearden Aug 18 '12 at 20:05

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