Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2015 02:49:16 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Replace all remaining $bp global touches with buddypress().

All existing tests continue to pass as normal. I will further manually scrutinize each replacement to ensure correctness.

Fixes #5138. Any stragglers or updates will reference this ticket.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r9351 r9471  
    2121 * @since BuddyPress (1.5.0)
    2222 *
    23  * @global BuddyPress $bp The one true BuddyPress instance
    2423 * @return bool True if set, False if empty
    2524 */
    2625function bp_groups_has_directory() {
    27     global $bp;
     26    $bp = buddypress();
    2827
    2928    return (bool) !empty( $bp->pages->groups->id );
     
    301300 */
    302301function groups_is_valid_status( $status ) {
    303     global $bp;
     302    $bp = buddypress();
    304303
    305304    return in_array( $status, (array) $bp->groups->valid_status );
     
    313312 */
    314313function groups_check_slug( $slug ) {
    315     global $bp;
     314    $bp = buddypress();
    316315
    317316    if ( 'wp' == substr( $slug, 0, 2 ) )
     
    365364 */
    366365function groups_leave_group( $group_id, $user_id = 0 ) {
    367     global $bp;
    368366
    369367    if ( empty( $user_id ) )
     
    399397 */
    400398function groups_join_group( $group_id, $user_id = 0 ) {
    401     global $bp;
    402399
    403400    if ( empty( $user_id ) )
     
    427424    if ( !$new_member->save() )
    428425        return false;
     426
     427    $bp = buddypress();
    429428
    430429    if ( !isset( $bp->groups->current_group ) || !$bp->groups->current_group || $group_id != $bp->groups->current_group->id )
     
    705704 */
    706705function groups_get_current_group() {
    707     global $bp;
    708 
    709     $current_group = isset( $bp->groups->current_group ) ? $bp->groups->current_group : false;
     706    $bp = buddypress();
     707
     708    $current_group = isset( $bp->groups->current_group )
     709        ? $bp->groups->current_group
     710        : false;
    710711
    711712    return apply_filters( 'groups_get_current_group', $current_group );
     
    722723 */
    723724function groups_avatar_upload_dir( $group_id = 0 ) {
    724     global $bp;
    725 
    726     if ( !$group_id )
    727         $group_id = $bp->groups->current_group->id;
     725
     726    if ( empty( $group_id ) ) {
     727        $group_id = bp_get_current_group_id();
     728    }
    728729
    729730    $path    = bp_core_avatar_upload_path() . '/group-avatars/' . $group_id;
     
    810811 */
    811812function groups_post_update( $args = '' ) {
    812     global $bp;
     813    $bp = buddypress();
    813814
    814815    $defaults = array(
Note: See TracChangeset for help on using the changeset viewer.