Skip to:
Content

BuddyPress.org

Changeset 4010


Ignore:
Timestamp:
02/02/2011 07:37:25 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Continued separation of forums and groups components.

Location:
trunk/bp-forums
Files:
3 edited

Legend:

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

    r3917 r4010  
    268268
    269269        if ( isset( $bbdb ) ) {
    270                 $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t". groups_add_forum_tables_sql( '' ) . " WHERE " . groups_add_forum_where_sql( "t.topic_status = 0" ) ) );
     270                if ( bp_is_active( 'groups' ) ) {
     271                        $groups_table_sql = groups_add_forum_tables_sql();
     272                        $groups_where_sql = groups_add_forum_where_sql( "t.topic_status = 0" );
     273                } else {
     274                        $groups_table_sql = '';
     275                        $groups_where_sql = "t.topic_status = 0";
     276                }
     277                $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" ) );
    271278                $count = count( (array)$count );
    272279        } else {
  • trunk/bp-forums/bp-forums-screens.php

    r3982 r4010  
    7272        global $bp;
    7373
     74        if ( !bp_is_forums_component() || !bp_is_current_action( 'topic' ) || empty( $bp->action_variables[0] ) )
     75                return false;
     76
    7477        do_action( 'bp_forums_screen_replies' );
    7578
    76         bp_core_load_template( apply_filters( 'bp_forums_screen_replies', 'members/single/home' ) );
     79        bp_core_load_template( apply_filters( 'bp_forums_screen_replies', 'forums/single/topic' ) );
    7780}
     81add_action( 'bp_screens', 'bp_forums_screen_replies' );
    7882
    7983function bp_forums_screen_favorites() {
  • trunk/bp-forums/bp-forums-template.php

    r3983 r4010  
    335335
    336336                $defaults = array(
    337                         'type' => 'thumb',
    338                         'width' => false,
     337                        'type'   => 'thumb',
     338                        'width'  => false,
    339339                        'height' => false,
    340                         'alt' => __( 'Profile picture of %s', 'buddypress' )
     340                        'alt'    => __( 'Profile picture of %s', 'buddypress' )
    341341                );
    342342
    … …  
    376376                global $forum_template;
    377377
    378                 return apply_filters( 'bp_get_the_topic_object_name', $forum_template->topic->object_name );
     378                if ( isset( $forum_template->topic->object_name ) )
     379                        $retval = $forum_template->topic->object_name;
     380                else
     381                        $retval = '';
     382
     383                return apply_filters( 'bp_get_the_topic_object_name', $retval );
    379384        }
    380385
    … …  
    394399                global $bp, $forum_template;
    395400
    396                 /* Currently this will only work with group forums, extended support in the future */
    397                 return apply_filters( 'bp_get_the_topic_object_permalink', bp_get_root_domain() . '/' . $bp->groups->root_slug . '/' . $forum_template->topic->object_slug . '/forum/' );
     401                // Currently this will only work with group forums, extended support in the future
     402                if ( bp_is_active( 'groups' ) )
     403                        $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $forum_template->topic->object_slug . '/forum/' );
     404                else
     405                        $permalink = '';
     406
     407                return apply_filters( 'bp_get_the_topic_object_permalink', $permalink );
    398408        }
    399409
    … …  
    416426                global $forum_template;
    417427
     428                if ( !isset( $forum_template->topic->object_id ) )
     429                        return false;
     430
    418431                $defaults = array(
    419                         'type' => 'thumb',
    420                         'width' => false,
     432                        'type'   => 'thumb',
     433                        'width'  => false,
    421434                        'height' => false,
    422                         'alt' => __( 'Group logo for %s', 'buddypress' )
     435                        'alt'    => __( 'Group logo for %s', 'buddypress' )
    423436                );
    424437
    … …  
    547560                global $forum_template, $bp;
    548561
    549                 if ( !empty( $forum_template->topic->object_slug ) )
    550                         $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->groups->root_slug . '/' . $forum_template->topic->object_slug );
    551                 else if ( !empty( $bp->is_single_item ) )
    552                         $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() );
     562                if ( bp_is_active( 'groups' ) && !empty( $forum_template->topic->object_slug ) )
     563                        $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $forum_template->topic->object_slug . '/forum' );
     564                else if ( bp_is_single_item() )
     565                        $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item() );
    553566                else
    554                         $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . $bp->current_action );
    555 
    556                 return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'forum/topic/' . $forum_template->topic->topic_slug ) );
     567                        $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . $bp->current_action );
     568
     569                return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) );
    557570        }
    558571
Note: See TracChangeset for help on using the changeset viewer.