I'm upgrading a drupal site from 4.6 to 5.1 and got the latest version of the taxonomy_context.module. After installing it I noticed it wasn't behaving as it did before. Specifically nodes are not being listed in the taxonomy context block menus. When viewing the source it looks as if no matter what Show nodes in block setting I choose no nodes are listed for any of the terms, and an empty unordered list is left open.

<ul class="menu"/>

This isn't even correct XHTML.

It seems that the culprit maybe the following functions:

function taxonomy_context_menu_tree($vid, $tid = NULL) {
...
}

function taxonomy_context_show_nodes($tid) {
...
}

Any help on this would be nice, also I'm not sure but the problem maybe a result of me upgrading versions of drupal (I don't know it's just a thought) if others aren't experiencing this problem.

CommentFileSizeAuthor
#3 126259_0.patch1.38 KBdouggreen
#2 126259.patch1.53 KBdouggreen

Comments

eferraiuolo’s picture

Status: Active » Needs review

Ok, I've seemed to figure this one out... It's an issue related to the naming of variables in the PHP code, compared with in the database.

Two functions in the PHP .module file are looking for the variable in the database table variable: "taxonomy_context_block_node"; while the database has this variable's value (which is set by the Taxonomy Context module's admin settings) stored in the table with the name "taxonomy_context_node_block".

Therefore I renamed this variable in all places where it's called (which is the two functions I referenced originally).:

/**
 * Return a menu tree for a vocabulary.
 */
function taxonomy_context_menu_tree($vid, $tid = NULL) {
...
  variable_get('taxonomy_context_block_node', TAXONOMY_CONTEXT_NODE_BLOCK_NONE)
...
}

/**
 * Return a list of nodes below the given term
 */
function taxonomy_context_show_nodes($tid) {
...
  variable_get('taxonomy_context_block_node', TAXONOMY_CONTEXT_NODE_BLOCK_NONE)
...
}

So it all came down to a simple typo error, I find the following find and replace:
Find:

variable_get('taxonomy_context_block_node', TAXONOMY_CONTEXT_NODE_BLOCK_NONE)

Replace:

variable_get('taxonomy_context_node_block', TAXONOMY_CONTEXT_NODE_BLOCK_NONE)

I wasn't sure the right way to make a patch to fix this issue, so if someone would like to make a patch, and commit the patch file for the next revision of this module, that would be great!

douggreen’s picture

StatusFileSize
new1.53 KB

Patch attached

douggreen’s picture

StatusFileSize
new1.38 KB

Oops, try this one.

nedjo’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch.

douggreen’s picture

Status: Reviewed & tested by the community » Fixed

Thanks nedjo for the CVS access. I've committed this to the HEAD and DRUPAL-5 branches, per your request.

killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)