Posted by earnie on March 16, 2009 at 12:43pm
2 followers
Jump to:
| Project: | XML sitemap |
| Version: | 6.x-1.x-dev |
| Component: | xmlsitemap.module |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
Because
<?php
$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
<?php
function xmlsitemap_anonymous_access() {
global $user;
return $user->uid == 0;
}
?>Changing the above to
<?php
function xmlsitemap_anonymous_access() {
return TRUE;
}
?>allows all to be able to access the sitemap but so will this change
<?php
$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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| xmlsitemap_anonymous_access_removal.patch | 1.72 KB | Ignored: Check issue status. | None | None |
Comments
#1
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.
#2
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.
#3
To change the global user variable is not adviced.