Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If using taxonomynode module, each taxonomy term can be linked in a one-to-one relationship to a node. If this node is unpublished, then anonymous users should not be able to view the node or the attached term.
I propose the following diff. What do you all think?
--- site_map.module (revision 32878)
+++ site_map.module (working copy)
@@ -351,7 +351,19 @@
// taxonomy_get_tree() honors access controls
$tree = taxonomy_get_tree($vid);
+ // Check to see if taxonomynode module is enabled
+ $taxonomynode_module_enabled = module_exists('taxonomynode');
foreach ($tree as $term) {
+ // If it's enabled, see if the term has a node attached to it and load it.
+ if ($taxonomynode_module_enabled) {
+ $nid = _taxonomynode_get_nid_from_tid($term->tid);
+ $term_node = isset($nid) ? node_load($nid) : FALSE;
+ // If taxonomynode is enabled, only continue if there is no node attached
+ // to that term or if the node that is attached to it is published
+ if ($term_node && !$term_node->status) {
+ continue;
+ }
+ }
$term->count = taxonomy_term_count_nodes($term->tid);
if ($term->count <= $threshold) {
continue;