I'm trying to learn Drupal 6. I want to register the path '/topic' to a MENU_CALLBACK using hook_menu(). Here's what I have:
function mymodule_menu() {
   $items = array()
   $items['foo'] = array( 
       'page callback' => 'show_page_foo',
       'access callback'   => 'user_access',
       'access arguments' => array('access foo content'),
       'type'     => MENU_CALLBACK 
     );
}
function show_page_foo() {
   //show foo page
}
This works fine for a logged in user. But when I visit the path as an anonymous user it shows 'Access Denied' message. What must be the 'access callback' and 'access arguments' values to have this accessible to all visitors?
I remember I made this work by simply saying 'access' => TRUE in开发者_StackOverflow Drupal 5. No longer works in Drupal 6.
You can use permission like you show and give the permission to anonymous users.
You can also do
'access callback' => TRUE
'access callback' should be a function returning a boolean value, and 
'access callback' => TRUE will work fine. Anyway i would suggest you not to use a constant value, for a cleaner access control. Use 
'access callback' => 'user_access',
'access arguments' => array('access content'),
instead, that's one generic enough permission. Or try the permission better fitting your needs. You can omit the access callback itself, since user_access is used as the default one.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论