I tweaked the code to do just that if anybody is interested

//line 268
      if ($get_node_count && $mode == 'page') {

//becomes
      if ($get_node_count ) {



//and lines 439-444

    if ($term->depth < $tree[$m+1]->depth) {
      $output .= "<li class=\"expanded\">". $link ."\n";
    }
    else {
      $output .= "<li class=\"leaf\">". $link ."</li>\n";  
    }

//become
if ($term->count) {//addition

    if ($term->depth < $tree[$m+1]->depth) {
      $output .= "<li class=\"expanded\">". $link ."\n";
    }
    else {
	  $output .= "<li class=\"leaf\">". $link ."</li>\n";  
    }
}//addition

or it could also be incorporated in the code with a configuration setting of whether to display terms with no nodes
(but I am not familiar with the drupal code yet to do it)

CommentFileSizeAuthor
#3 sitemenu-hide_empty.patch1.92 KBsystemparadox

Comments

theunsd’s picture

Thanks, this really helped me a lot. It would be nice if the developer built that in as a configuration setting. I'm sure we aren't the only 2 guys who have needed this. Thanks again!

kbahey’s picture

Status: Active » Needs work

If someone prepares a proper tested working patch, with an optional settings, I will commit.

systemparadox’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.92 KB

Patch attached. Unlike the modification above it still displays the nodes. Adds an option to the settings page.
Empty vocabularies will still be shown, but I don't think this matters. You could always disable them manually in the config page.

kbahey’s picture

Anyone tested this?

Do you like this feature.

I am looking for input.

xpi’s picture

the patch is fine for me.

but when using the Content Access module
sitemenu ignores the permissions set.
nodes hidden from anonymous roles are displayed.

manoloka’s picture

Strange I've just changed it as you say and what it happens it's completely the opposite;

it only display terms that do NOT have nodes associated with them

what did I do wrong?

manoloka’s picture

my mistake

I've found what I did wrong and it works like charm

Thanks :-)

manoloka’s picture

Wouldn't it be great to add this function as an option.

That's it, somewhere you can tick to choose whether to see them all or only the ones that have something in it.

aharown07’s picture

+1 for option to see only terms w/corresponding nodes.