Skip to:
Content

BuddyPress.org

Changeset 4012


Ignore:
Timestamp:
02/02/2011 08:52:58 AM (14 years ago)
Author:
johnjamesjacoby
Message:

First pass at introducing forums directory, single forum, and single topic views. This is mostly copy/paste from groups component with some rough logic in place to display the proper screens. More to do here.

Location:
trunk
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-loader.php

    r3933 r4012  
    129129            'parent_url'      => $forums_link,
    130130            'parent_slug'     => $this->slug,
    131             'screen_function' => 'bp_forums_screen_topics',
     131            'screen_function' => 'bp_member_forums_screen_topics',
    132132            'position'        => 20,
    133133            'item_css_id'     => 'forums-friends'
     
    140140            'parent_url'      => $forums_link,
    141141            'parent_slug'     => $this->slug,
    142             'screen_function' => 'bp_forums_screen_replies',
     142            'screen_function' => 'bp_member_forums_screen_replies',
    143143            'position'        => 40,
    144144            'item_css_id'     => 'forums-friends'
     
    151151            'parent_url'      => $forums_link,
    152152            'parent_slug'     => $this->slug,
    153             'screen_function' => 'bp_forums_screen_favorites',
     153            'screen_function' => 'bp_member_forums_screen_favorites',
    154154            'position'        => 60,
    155155            'item_css_id'     => 'forums-favs'
  • trunk/bp-forums/bp-forums-screens.php

    r4010 r4012  
    6161add_action( 'bp_screens', 'bp_forums_directory_forums_setup' );
    6262
    63 function bp_forums_screen_topics() {
     63function bp_member_forums_screen_topics() {
    6464    global $bp;
    6565
    66     do_action( 'bp_forums_screen_topics' );
     66    do_action( 'bp_member_forums_screen_topics' );
    6767
    6868    bp_core_load_template( apply_filters( 'bp_forums_screen_topics', 'members/single/home' ) );
    6969}
    7070
    71 function bp_forums_screen_replies() {
     71function bp_member_forums_screen_replies() {
     72    global $bp;
     73
     74    do_action( 'bp_member_forums_screen_replies' );
     75
     76    bp_core_load_template( apply_filters( 'bp_member_forums_screen_replies', 'members/single/home' ) );
     77}
     78
     79function bp_member_forums_screen_favorites() {
     80    global $bp;
     81
     82    do_action( 'bp_member_forums_screen_favorites' );
     83
     84    bp_core_load_template( apply_filters( 'bp_member_forums_screen_favorites', 'members/single/home' ) );
     85}
     86
     87function bp_forums_screen_single_forum() {
     88    global $bp;
     89
     90    if ( !bp_is_forums_component() || !bp_is_current_action( 'forum' ) || empty( $bp->action_variables[0] ) )
     91        return false;
     92
     93    do_action( 'bp_forums_screen_single_forum' );
     94
     95    bp_core_load_template( apply_filters( 'bp_forums_screen_single_forum', 'forums/single/forum' ) );
     96}
     97add_action( 'bp_screens', 'bp_forums_screen_single_forum' );
     98
     99function bp_forums_screen_single_topic() {
    72100    global $bp;
    73101
     
    75103        return false;
    76104
    77     do_action( 'bp_forums_screen_replies' );
     105    do_action( 'bp_forums_screen_single_topic' );
    78106
    79     bp_core_load_template( apply_filters( 'bp_forums_screen_replies', 'forums/single/topic' ) );
     107    bp_core_load_template( apply_filters( 'bp_forums_screen_single_topic', 'forums/single/topic' ) );
    80108}
    81 add_action( 'bp_screens', 'bp_forums_screen_replies' );
    82 
    83 function bp_forums_screen_favorites() {
    84     global $bp;
    85 
    86     do_action( 'bp_forums_screen_favorites' );
    87 
    88     bp_core_load_template( apply_filters( 'bp_forums_screen_favorites', 'members/single/home' ) );
    89 }
     109add_action( 'bp_screens', 'bp_forums_screen_single_topic' );
    90110
    91111?>
  • trunk/bp-forums/bp-forums-template.php

    r4010 r4012  
    449449
    450450        $defaults = array(
    451             'type' => 'thumb',
    452             'width' => false,
     451            'type'   => 'thumb',
     452            'width'  => false,
    453453            'height' => false,
    454             'alt' => __( 'Profile picture of %s', 'buddypress' )
     454            'alt'    => __( 'Profile picture of %s', 'buddypress' )
    455455        );
    456456
     
    565565            $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item() );
    566566        else
    567             $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . $bp->current_action );
     567            $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() );
    568568
    569569        return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) );
     
    901901    if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && 'topic' == $bp->action_variables[0] )
    902902        $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );
     903    elseif ( empty( $topic_id ) && bp_is_current_component( 'forums') && bp_is_current_action( 'topic' ) && !empty( $bp->action_variables[0] ) )
     904        $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[0] );
    903905
    904906    if ( is_numeric( $topic_id ) ) {
     
    11071109}
    11081110
    1109 function bp_forum_permalink() {
    1110     echo bp_get_forum_permalink();
    1111 }
    1112     function bp_get_forum_permalink() {
    1113         global $bp;
    1114 
    1115         if ( $bp->is_single_item )
    1116             $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() );
     1111function bp_forum_permalink( $forum_id = 0 ) {
     1112    echo bp_get_forum_permalink( $forum_id );
     1113}
     1114    function bp_get_forum_permalink( $forum_id = 0 ) {
     1115        global $bp;
     1116
     1117        if ( bp_is_groups_component() ) {
     1118            $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . 'forum' );
     1119        } else {
     1120            if ( empty( $forum_id ) ) {
     1121                global $topic_template;
     1122                if ( isset( $topic_template->forum_id ) )
     1123                    $forum_id = $topic_template->forum_id;
     1124            }
     1125
     1126            if ( $forum = bp_forums_get_forum( $forum_id ) )
     1127                $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug );
     1128            else
     1129                return false;
     1130        }
     1131
     1132        return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
     1133    }
     1134
     1135function bp_forum_name( $forum_id = 0 ) {
     1136    echo bp_get_forum_name( $forum_id );
     1137}
     1138    function bp_get_forum_name( $forum_id = 0 ) {
     1139        global $bp;
     1140
     1141        if ( empty( $forum_id ) ) {
     1142            global $topic_template;
     1143            if ( isset( $topic_template->forum_id ) )
     1144                $forum_id = $topic_template->forum_id;
     1145        }
     1146
     1147        if ( $forum = bp_forums_get_forum( $forum_id ) )
     1148            return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id );
    11171149        else
    1118             $permalink = trailingslashit( bp_get_root_domain() . $bp->current_component . '/' . $bp->current_action );
    1119 
    1120         return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink . 'forum' ) );
     1150            return false;
    11211151    }
    11221152
  • trunk/bp-groups/bp-groups-screens.php

    r3983 r4012  
    416416    global $bp;
    417417
    418     if ( !bp_is_current_component( 'groups' ) || !bp_is_current_action( $bp->activity->slug ) || empty( $bp->action_variables[0] ) )
     418    if ( !bp_is_groups_component() || ( bp_is_active( 'activity' ) && !bp_is_current_action( $bp->activity->slug ) ) || empty( $bp->action_variables[0] ) )
    419419        return false;
    420420
Note: See TracChangeset for help on using the changeset viewer.