Index: taxonomy_menu.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_menu/taxonomy_menu.module,v retrieving revision 1.19.2.2.2.68 diff -u -r1.19.2.2.2.68 taxonomy_menu.module --- taxonomy_menu.module 20 Oct 2010 02:26:17 -0000 1.19.2.2.2.68 +++ taxonomy_menu.module 1 Nov 2010 20:31:44 -0000 @@ -766,23 +766,34 @@ } /** - * Helper function to see if any of the children have any nodes - * - * @param $tid - * @param $vid - * @return boolean - */ -function _taxonomy_menu_children_has_nodes($tid, $vid, $has_nodes = FALSE) { - if (!$has_nodes) { +* Helper function to see if any of the children have any nodes +* +* @param $tid +* @param $vid +*/ +function _taxonomy_menu_children_has_nodes($tid, $vid) { + $has_nodes = taxonomy_term_count_nodes($tid); + if($has_nodes > 0) + { + return true; + } + else + { $children = taxonomy_get_children($tid, $vid); - foreach ($children as $tid => $term) { - if (_taxonomy_menu_term_count($tid) > 0) { - return _taxonomy_menu_children_has_nodes($tid, $vid, TRUE); + foreach ($children as $child_tid => $term) { + if (_taxonomy_menu_term_count($child_tid) > 0) { + $child_has_nodes = _taxonomy_menu_children_has_nodes($child_tid, $vid); + if($child_has_nodes) + { + return true; + } } - } + } } - return $has_nodes; + + return false; } + /** * Helper function for insert and update hooks */