Skip to:
Content

BuddyPress.org

Changeset 2168 for trunk/bp-forums.php


Ignore:
Timestamp:
12/14/2009 03:24:05 PM (16 years ago)
Author:
apeatling
Message:

Committing core code support for new default theme.

Removed all deprecated code since it will be released as a separate plugin for backwards compatibility if people need it.

Removed the wire and status updates components since there is no support in the theme for these. If people still want this functionality then I'm sure there is someone in the community that could spend a bit of time and release them as plugins. I'm happy to guide.

Removed a lot of template loop duplication. There are no longer site loops and user loops (e.g. bp_has_site_groups() / bp_has_groups() ). There are now bp_has_members(), bp_has_groups(), bp_has_blogs() and you can pass a "user_id" parameter into these loops to limit results to only that user or users.

Merged activity stream functions. There are no longer functions for bp_activity_get_sitewide() / bp_activity_get_for_user() / bp_activity_get_friends_activity() instead there is simply one function: bp_activity_get() and you can pass in parameters to filter on just friends, for a single user, or anything your heart desires. Actually, filtering is extremely fine grained, so I encourage devs to check out the filter functions.

Lots of other code cleanup.

The new default theme will be committed straight after this. The original default folder will be renamed to bp-classic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums.php

    r2077 r2168  
    6262
    6363        do_action( 'bbpress_init' );
     64
     65        /* Check to see if the user has posted a new topic from the forums page. */
     66        if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
     67            /* Check the nonce */
     68            check_admin_referer( 'bp_forums_new_topic' );
     69
     70            if ( $group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) {
     71                /* Auto join this user if they are not yet a member of this group */
     72                if ( !is_site_admin() && 'public' == $group->status && !groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
     73                    groups_join_group( $group->id, $group->id );
     74
     75                if ( $forum_id = groups_get_groupmeta( $group->id, 'forum_id' ) ) {
     76                    if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
     77                        bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
     78                    else
     79                        bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
     80
     81                    bp_core_redirect( bp_get_group_permalink( $group ) . '/forum/topic/' . $topic->topic_slug . '/' );
     82                }
     83            }
     84        }
     85
    6486        do_action( 'bp_forums_directory_forums_setup' );
    65         bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'directories/forums/index' ) );
     87
     88        bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
    6689    }
    6790}
     
    391414}
    392415add_filter( 'user_has_cap', 'bp_forums_filter_caps' );
     416
     417/**
     418 * bp_forums_filter_template_paths()
     419 *
     420 * Add fallback for the bp-sn-parent theme template locations used in BuddyPress versions
     421 * older than 1.2.
     422 *
     423 * @package BuddyPress Core
     424 */
     425function bp_forums_filter_template_paths() {
     426    if ( 'bp-sn-parent' != basename( TEMPLATEPATH ) && !defined( 'BP_CLASSIC_TEMPLATE_STRUCTURE' ) )
     427        return false;
     428
     429    add_filter( 'bp_forums_template_directory_forums_setup', create_function( '', 'return "directories/forums/index";' ) );
     430}
     431add_action( 'init', 'bp_forums_filter_template_paths' );
     432
    393433?>
Note: See TracChangeset for help on using the changeset viewer.