My module implements template_preprocess_hook, but when it fires, the $variables['node_url'] is not set yet. I have gone through the theming guide and tried just about every preprocess hook there is and none of them has that variable set when I get control.

It is set in theme.inc in template_preprocess_node, without regard as to whether or not it is already set. I even tried mymodule_preprocess_node, and it is still not set there.

The problem may be because my module's weight is -2 due to a timing problem with the user module. So I am probably getting called before node.module too. -- I changed the weight to +1 and it made no difference.

So how can I change the value of $node->url?

Comments

FrontBurner’s picture

I am trying to do the same thing, I have attempted to alter the path using hook_nodeapi. However by the time the node is rendered to html the path is changed back to what it originally was. Very strange since I have set the weight of my module to 100.

I then tried using a theme preprocess function but again, by the time the page is rendered my path changes have been altered. The only way I could figure out how to alter my paths was at the node.tpl.php level. I hate putting logic in template files but I have spent 4 plus hours trying to figure out alternatives with no luck.

If you come up with a solution for doing this within a module please let me know.