6

I am trying my first module on Drupal 7 on the behalf of experience on Drupal 6.

function custom_work_menu(){
  $items = array();

  $items['mypage']=array(
    'title'=>t('Title'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('custom_work_mypage_view'),
    'access arguments' => array('access content'),
  );

  return $items;
}

Upon accessing my page, I get access denied. What am I missing here?

1 Answer 1

8

Revised:

Your code looks right

3 Things could be the problem

  1. 'mypage' could be a banned link.
  2. you don't have access to 'custom_work_mypage_view' form.
  3. Clear your cache. Without the 'access argument' line you will get access denied. If you added it then save your file, you will still get access denied until you clear your cache.

My gut feeling is #3.

1
  • 1
    access callback can not take place here, access callback is defined in string unlike access arguments as array. Commented Jul 20, 2011 at 17:09

Your Answer

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