forum.module has the following function:

function forum_link_alter(&$links, $node) {
  foreach ($links as $module => $link) {
    if (strstr($module, 'taxonomy_term')) {
      // Link back to the forum and not the taxonomy term page. We'll only
      // do this if the taxonomy term in question belongs to forums.
      $tid = str_replace('taxonomy/term/', '', $link['href']);
      $vid = variable_get('forum_nav_vocabulary', '');
      $term = taxonomy_get_term($tid);
      if ($term->vid == $vid) {
        $links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
      }
    }
  }
}

Just as forum.module changes 'taxonomy/term' to 'forum', image_gallery.module changes 'taxonomy/term' to 'image/tid', but forum.module (which runs after image_gallery.module) is not prepared to handle this. After image_gallery, forum_link_alter() gets called with $links set as follows (for example):

$links                 Array[1]
  taxonomy_term_10     Array[3]
    title              'Name of Gallery'
    href               'image/tid/10'
    attributes         Array[2]
      rel              'tag'
      title            ''

..., so $tid becomes image/tid/10 and is then passed on to taxonomy_get_term(), which returns FALSE to $term.

The subsequent if causes

notice: Trying to get property of non-object in drupal-6\modules\forum\forum.module on line 479.

The attached patch checks $tid with is_numeric() before calling taxonomy_get_term().

BTW, this code is not in D7, so the patch is for D6.

CommentFileSizeAuthor
forum.forum_link_alter-D6.patch1.13 KBsalvis

Comments

salvis’s picture

Status: Needs review » Closed (fixed)