Because

  $items['sitemap.xml'] = array(
    'title' => 'Site map index',
    'page callback' => 'xmlsitemap_output',
    'access callback' => 'xmlsitemap_anonymous_access',
    'type' => MENU_CALLBACK,
  );

and then this returns FALSE for authenticated users

function xmlsitemap_anonymous_access() {
  global $user;
  return $user->uid == 0;
}

Changing the above to

function xmlsitemap_anonymous_access() {
  return TRUE;
}

allows all to be able to access the sitemap but so will this change

  $items['sitemap.xml'] = array(
    'title' => 'Site map index',
    'page callback' => 'xmlsitemap_output',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

based on the review of the code at http://api.drupal.org/api/function/_menu_check_access/6 and my testing.

Patch is based on the menu change.

CommentFileSizeAuthor
xmlsitemap_anonymous_access_removal.patch1.72 KBAnonymous (not verified)

Comments

avpaderno’s picture

Category: bug » support
Status: Needs review » Closed (duplicate)

See what reported in the project page; it's not a bug at all. I am setting it like duplicate of an already existing report.

Anonymous’s picture

Sorry for wasting your time; I should have looked. I will try to come up with an alternative, something like not creating the map data if the user is authenticated but allowing the authenticated user to visit /sitemap.xml. The other alternative would be to change the global $user->id to 0 before updating the sitemap data and then changing $user->id back to the original value.

avpaderno’s picture

To change the global user variable is not adviced.