Solved

Drupal hook menu : some links give 403 error unless in Uppercase

Posted on 2011-03-03
3
474 Views
Last Modified: 2012-05-11
Hi

I've many Drupal sites but have hit a brick wall with a very strange issue.

I have hook_menu setup in my module with code as follows :

 $items['home'] = array(
    'title' => 'HOME',
    'page callback' => 'home',
    'menu_name' => 'primary-links',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/_mysite_home.inc'
  );

$items['about'] = array(
    'title' => 'ABOUT',
    'page callback' => 'about',
    'menu_name' => 'primary-links',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/_mysite_about.inc'
  );

The 'home' link works fine .. but the 'about' link gives a 403 Error .. and I can see the page if I change 'about' to 'ABOUT' at the end of the address in the address bar and refresh the page.

Wasted a lot of time trying to make this go away .. hopefully someone can point me in the right direction.

Cheers

E.
0
Comment
Question by:eppyfone
  • 2
3 Comments
 
LVL 9

Expert Comment

by:oliverpolden
ID: 35032448
What's wrong with just creating a page via the CMS with those addresses?

Anyway, do you have an 'about()' function in _mysite_about.inc?  If you have a home() function and not an about() function, that's probably the difference.

'page callback' => 'about' means that Drupal will try to use a function called about.  Without it I guess the menu system will not properly register the item and you get an access denied because the access arguments
0
 

Accepted Solution

by:
eppyfone earned 0 total points
ID: 35035153
Hi .. Thanks for your response .. but I've solved this myself !!

There was a folder in the root of the file system called 'about'.
Drupal was confused and decided to not allow access to it as it was not part of the CMS setup.
It therefore made a decision to put the internal page in a path with Caps to differentiate.
Smart or obstinate .. still gotta love it.

So .. check there's not a stray folder in the root setup.

Job done ... moving on...

E.
0
 

Author Closing Comment

by:eppyfone
ID: 35865618
Solved myself as explained above
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now