I described this in the Post-installation Forum http://drupal.org/node/511826 and it was suggested that an issue here might be appropriate.

This was discovered while exploring another problem that may or may not be related, http://drupal.org/node/511144

Essentially, the problem is that while forums are like taxonomy terms and if you use the clean url http://example.com/taxonomy/term/xxx where xxx = forum number, you see a stream of teasers for the forum items just as you would see a stream of teasers for any other taxonomy term.

However, Taxonomy terms are not Forums. That is why it doesn't seem right when a url like http://example.com/forum/xxx where xxx = tid of a term that is not a forum or a container yields a display that mimics a forum topic listing and then includes a message that "The topic has been moved", when in fact the topic has not been moved and is in the forum where it was created.

This behaviour seems odd and it would be more appropriate if the user received an error message, like page not found, or not a forum.

I hope I have explained this well enough. Any thoughts on this would be appreciated. Thanks,

Izzy

Comments

michelle’s picture

Version: 6.13 » 7.x-dev

Bumping the version. AFAIK, this behavior hasn't changed in D7 so it needs to be fixed there and backported. Something along the lines of this pseudo code:

function forum_page($tid = 0) {
  $vid = variable_get('forum_nav_vocabulary', '');

  $is_forum = $tid a member of $vid

  if (!is_numeric($tid) || !$is_forum) {
    return MENU_NOT_FOUND;
  }
}

Actually, checking if the tid is in the vid would probably get rid of the need for the newly added check if it's numeric.

Anyway, that needs more fleshing out, obviously, but that's the general idea. I'll probably figure out the exact code and add it to AF at some point. If I do, I'll post back the exact code to do it for D6 and then someone can port that to D7.

Michelle

Ainur’s picture

This can get very messy, aseptically, if you are using pathauto module to generate aliases like forum/2009/10/13/page-title-or-nid. I have tons of duplicated pages in google index instead of 404 pages. Versions 5.x and 6.x are also affected.

This code, right after $tid = (int)$tid; solved the problem for me, for Drupal 5.x version:

  $term = taxonomy_get_term($tid);
  $forum_nav_vocabulary = variable_get('forum_nav_vocabulary', '');
  // Check if this is a valid term from forum nav vocabulary.
  if (!empty($tid) and $term->vid != $forum_nav_vocabulary) {
    return drupal_not_found();
  } 

we need !empty($tid) check in order to keep our main forum page.

Ainur’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new806 bytes

Tested on Drupal 5.x, should work for 6.x also

Ainur’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new883 bytes

Here is patch for 7.x version based on 5.x and 6.x patches

Status: Needs review » Needs work

The last submitted patch failed testing.

andypost’s picture