Skip to:
Content

BuddyPress.org

Changeset 2168 for trunk/bp-core.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-core.php

    r2128 r2168  
    4343    require ( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php' );
    4444
    45 /* If BP_IGNORE_DEPRECATED is defined, do not load any deprecated functions for backwards support */
    46 if ( !defined( 'BP_IGNORE_DEPRECATED' ) )
    47     require ( BP_PLUGIN_DIR . '/bp-core/deprecated/bp-core-deprecated.php' );
    48 
    4945/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
    5046if ( !defined( 'BP_MEMBERS_SLUG' ) )
     
    6662if ( !defined( 'BP_HOME_BLOG_SLUG' ) )
    6763    define( 'BP_HOME_BLOG_SLUG', 'blog' );
    68 
    69 /* Register BuddyPress themes contained within the theme folder */
    70 if ( function_exists( 'register_theme_folder' ) )
    71     register_theme_folder( 'buddypress/bp-themes' );
    7264
    7365/* Register BuddyPress themes contained within the theme folder */
     
    381373
    382374/********************************************************************************
    383  * Screen Functions
    384  *
    385  * Screen functions are the controllers of BuddyPress. They will execute when their
    386  * specific URL is caught. They will first save or manipulate data using business
    387  * functions, then pass on the user to a template file.
    388  */
    389 
    390 
    391 /********************************************************************************
    392375 * Action Functions
    393376 *
     
    397380 */
    398381
    399 
    400382/**
    401383 * bp_core_action_directory_members()
     
    416398
    417399        do_action( 'bp_core_action_directory_members' );
    418         bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'directories/members/index' ) );
     400        bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'members/index' ) );
    419401    }
    420402}
     
    653635     * looking at their own profile, don't create the nav item.
    654636     */
    655     if ( !$show_for_displayed_user && !bp_is_home() )
     637    if ( !$show_for_displayed_user && !bp_is_my_profile() )
    656638        return false;
    657639
     
    11761158    $user_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) );
    11771159    return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) );
     1160}
     1161
     1162/**
     1163 * bp_core_get_total_member_count()
     1164 *
     1165 * Returns the total number of members for the installation.
     1166 *
     1167 * @package BuddyPress Core
     1168 * @return int The total number of members.
     1169 */
     1170function bp_core_get_total_member_count() {
     1171    global $wpdb;
     1172
     1173    $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM " . CUSTOM_USER_TABLE . " WHERE spam = 0" ) );
     1174    return apply_filters( 'bp_core_get_total_member_count', (int)$count );
    11781175}
    11791176
     
    17601757 * bp_core_boot_spammer()
    17611758 *
    1762  * When a user logs in, check if they have been marked as a spammer. If then simply
     1759 * When a user logs in, check if they have been marked as a spammer. If yes then simply
    17631760 * redirect them to the home page and stop them from logging in.
    17641761 *
     
    18311828}
    18321829add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
     1830
     1831/**
     1832 * bp_core_filter_template_paths()
     1833 *
     1834 * Add fallback for the bp-sn-parent theme template locations used in BuddyPress versions
     1835 * older than 1.2.
     1836 *
     1837 * @package BuddyPress Core
     1838 */
     1839function bp_core_filter_template_paths() {
     1840    if ( 'bp-sn-parent' != basename( TEMPLATEPATH ) && !defined( 'BP_CLASSIC_TEMPLATE_STRUCTURE' ) )
     1841        return false;
     1842
     1843    add_filter( 'bp_core_template_directory_members', create_function( '', 'return "directories/members/index";' ) );
     1844    add_filter( 'bp_core_template_plugin', create_function( '', 'return "plugin-template";' ) );
     1845}
     1846add_action( 'init', 'bp_core_filter_template_paths' );
    18331847
    18341848/**
Note: See TracChangeset for help on using the changeset viewer.