Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/12/2011 12:32:15 AM (15 years ago)
Author:
djpaul
Message:

Correctly handle invalid forum permalinks. Also fixes a couple of PHP notices. Fixes #2349.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-screens.php

    r4088 r4124  
    104104
    105105function groups_screen_group_forum() {
    106     global $bp;
     106    global $bp, $wp_query;
    107107
    108108    if ( bp_is_single_item() && $bp->groups->current_group->user_has_access ) {
    109109
    110110        // Fetch the details we need
    111         $topic_slug     = isset( $bp->action_variables[1] ) ? $bp->action_variables[1] : false;
     111        $topic_slug     = !empty( $bp->action_variables[1] ) ? $bp->action_variables[1] : false;
    112112        $topic_id       = bp_forums_get_topic_id_from_slug( $topic_slug );
    113113        $forum_id       = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
     
    302302                bp_core_load_template( apply_filters( 'groups_template_group_forum_topic', 'groups/single/home' ) );
    303303            }
     304
     305        // Forum topic does not exist
     306        } elseif ( !empty( $topic_slug ) && empty( $topic_id ) ) {
     307            $wp_query->set_404();
     308            status_header( 404 );
     309            nocache_headers();
     310            return;
    304311
    305312        } else {
Note: See TracChangeset for help on using the changeset viewer.