Skip to:
Content

BuddyPress.org

Ticket #2598: 2598.diff

File 2598.diff, 1.3 KB (added by boonebgorges, 14 years ago)
  • bp-forums.php

     
    149149
    150150/* Topic Functions */
    151151
     152function bp_forums_topic_name_global() {
     153        global $bp;
     154       
     155        if ( !isset( $bp->action_variables[0] ) || !isset( $bp->action_variables[1] ) || !isset( $bp->action_variables[2] ) )
     156                return;
     157               
     158        if ( $bp->action_variables[1] != 'topic' )
     159                return;
     160       
     161        $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[2] );
     162
     163        $topic = get_topic( $topic_id );
     164       
     165        $bp->current_topic->id = $topic_id;
     166        $bp->current_topic->topic_name = $topic->topic_title;
     167}
     168add_action( 'bp_setup_globals', 'bp_forums_topic_name_global' );
     169
    152170function bp_forums_get_forum_topics( $args = '' ) {
    153171        global $bp;
    154172
  • bp-forums/bp-forums-filters.php

     
    8888                return "<a $text rel=\"nofollow\">";
    8989        }
    9090
     91function bp_forums_page_title( $title ) {
     92        global $bp;
     93       
     94        if ( isset( $bp->current_topic->topic_name ) )
     95                $title .= ' &#124; ' . $bp->current_topic->topic_name; 
     96       
     97        return $title;
     98}
     99add_filter( 'bp_page_title', 'bp_forums_page_title' );
     100
    91101?>
     102 No newline at end of file