$nid variable available to php paths is not always available (is set to zero)

Justin W Freeman - November 14, 2009 - 13:31
Project:Taxonomy Redirect
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

$nid variable available to php paths is not available when taxonomy_term_path is called from outside the taxonomy module.

The way it works means it is only available when called from taxonomy_link.

#1

Justin W Freeman - November 14, 2009 - 14:04
Status:active» fixed

I moved the code that gets the $nid variable out into it's own function.

The way it currently works works for standard drupal by checking for the node in the previous call to taxonomy_link.

I have added to that a check for the node in a previous hook_nodeapi function.
This means calls to taxonomy_term_path from a nodeapi function will get this $nid variable.
For example taxonomy_breadcrumb.

If there are other cases I think we will just have to add them as they pop up.
As it is now I think it covers most usage.

#2

Justin W Freeman - November 14, 2009 - 14:21

I have now added another case for when taxonomy_term_path is called from theme templates.

So if it is called from node.tpl.php or something like that the $nid variable will be there.

#3

Justin W Freeman - November 14, 2009 - 14:22
Title:$nid variable available to php paths is not always available» $nid variable available to php paths is not always available (is set to zero)

If anyone finds another case where the $nid variable is set to zero please reopen this case and give details.

#4

System Message - November 28, 2009 - 14:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.