By svendecabooter on
Hi,
I am working on a module and somewhere i need to get the path corresponding to a certain nid.
So i wrote this code:
$node = node_load(array('nid' => $nid));
$url = l($title, $node->path);
Now the weird thing: this works perfectly as long as i'm logged in as admin, but when i logout, the $url variable gets me to the base path (thus can not get the path from the node anymore). So anonymous users (about all visitors of the site) can't see this link!
I wonder what causes this behavior... The node_load() function gets called from a module, so i don't think this is a security issue...
I don't think it matters at all, but the node is a CCK type.
Anyone has an idea on how to solve this?
Kind regards
sven
Comments
I am having the same problem
I was about to give up searching for someone who had this problem and post a new question for myself.
To add to the details about this, "access content" is enabled for anonymous users, no other access control modules are installed, and the cck node fields are coming through just fine for anonymous users.
print content_format('field_teaser', $field_teaser[0]);prints exactly what is expected, but$pathand$node->pathare both empty.I don't know about xeniox, but in my case, these nodes are being displayed through a teaser list view.
This does seem to be a cck
This does seem to be a cck problem. Here are some potential workarounds:
http://drupal.org/node/87223