Different $node->path for authenticated vs anonymous users
Rob Loach - January 31, 2008 - 18:17
| Project: | Drupal |
| Version: | 5.x-dev |
| Component: | path.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
It seems like when an annonymous user is visiting a Drupal site, dumping $node, returns an empty $node->path. When logged in, however, $node->path is effectively setup. The SQL runs fine, can't find out what's wrong with $node->path.
Any ideas?

#1
The problem is that the path_nodeapi() call that inserts the path attribute ($op = 'load') will never get called for anon users UNLESS they have been granted either 'create url aliases' || 'administer url aliases' permissions!
#2
It feels like we could load the path attribute no matter what permissions the user have. This "bug" is also present in 6.x, so reassigning.
#3
This patch removes the check for the 'create url aliases' || 'administer url aliases' permissions.
#4
The
user_access()check is still needed for every operation that is not"load". Please only remove it for that operation.Damien
#5
#6
This patch uses
user_accesson everything except'load'.#7
A bit more elegant.
#8
This is my favorite issue of the month. And February just started!
#9
#10
Whoops, I meant to mark it RTBC. Thanks, Moshe.
#11
+1, seems good to go.
#12
Ugh, committed.
#13
We need a backport for 5.x.
#14
Moved to the DRUPAL-5 branch.
#15
Not much to say: applies cleanly, does what advertised :)
#16
Thank you ever so much for this! I've grown extremely tired of manually loading the alias from the database when I needed it in a node object.
#17
Subscribing
#18
Committed to 5.x.
#19
Automatically closed -- issue fixed for two weeks with no activity.
#20
Hi, this is a bug I was interested in back in January, I put a site live having to use drupal_get_path_alias('node/'.nid) to set the path for anon users. I'm just developing a new site and noticed that this issue should be fixed.
I'm using Drupal 5.7 and pathauto 5.x-2.2 and am doing a node_load()
The path is there for me as administrator but not there for anonymous users. I haven't set any permissions for anonymous users but reading through this issue I'm assuming I shouldn't have to.
#21
Correction, this isn't fixed in Drupal 5.7. It will, however, be fixed in Drupal 5.8.... If you look at http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/path/path.module?r... , you'll see that the DRUPAL-5 branch has the fix, while the DRUPAL-5-7 tag (http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/path/path.module?r...) doesn't.
#22
Resetting title.
#23
Automatically closed -- issue fixed for two weeks with no activity.