Breaks Tagadelic Weighting

elyobo - November 1, 2009 - 11:36
Project:Taxonomy Redirect
Version:6.x-1.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

The tagadelic module works by calculating the weighting for each taxonomy term and storing it in the weight property of the taxonomy object. The taxonomy_redirect module, in the taxonomy_redirect_term_path() function, resets this property to the default (in case the term passed into the function is incomplete).

Now, I would suggest that the tagadelic module should probably be storing the weight that it wants to use somewhere other than the default weight location, but I would also suggest that the taxonomy_redirect_term_path() function shouldn't be stamping on that value if it has already been set anyway. I'll post a similar bug to the tagadelic issue queue.

Anyhow, working around this is easy - just check whether the values have been set already before resetting them to the defaults, i.e. change this code

// Get term data in case the term passed in is incomplete.
$t = taxonomy_get_term($term->tid);
$term->name = $t->name;
$term->description = $t->description;
$term->weight = $t->weight;

to this

// Get term data in case the term passed in is incomplete.
$t = taxonomy_get_term($term->tid);
if (!isset($term->name)) {
$term->name = $t->name;
}
if (!isset($term->description)) {
$term->description = $t->description;
}
if (!isset($term->weight)) {
$term->weight = $t->weight;
}

I've attached a patch against the current release to do this.

AttachmentSize
taxonomy_redirect_nostamp.patch734 bytes

#1

elyobo - November 1, 2009 - 11:40

Note that upcoming releases of tagadelic will be working around this anyway; I still suggest that the fix be made to ensure that similar problems don't happen with any other modules that attempt to do similar things. The tagadelic bug is listed over here - http://drupal.org/node/380100

#2

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

Thanks for the patch.

Committed to 5.x-1.x and 6.x-1.x branches.

#3

Justin W Freeman - November 14, 2009 - 06:41

#4

System Message - November 28, 2009 - 06:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.