Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2015 02:49:16 AM (10 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-template.php

    r9466 r9471  
    15001500 */
    15011501function bp_group_search_form() {
    1502     global $bp;
    15031502
    15041503    $action = bp_displayed_user_domain() . bp_get_groups_slug() . '/my-groups/search/';
     
    15971596 */
    15981597function bp_groups_auto_join() {
    1599     global $bp;
    1600 
    1601     return apply_filters( 'bp_groups_auto_join', (bool)$bp->groups->auto_join );
     1598    return apply_filters( 'bp_groups_auto_join', (bool) buddypress()->groups->auto_join );
    16021599}
    16031600
     
    18611858 */
    18621859function bp_group_get_invite_status( $group_id = false ) {
    1863     global $bp, $groups_template;
     1860    global $groups_template;
    18641861
    18651862    if ( !$group_id ) {
     1863        $bp = buddypress();
     1864
    18661865        if ( isset( $bp->groups->current_group->id ) ) {
    18671866            // Default to the current group first
     
    25582557     */
    25592558    function bp_get_group_accept_invite_link( $group = false ) {
    2560         global $groups_template, $bp;
     2559        global $groups_template;
    25612560
    25622561        if ( empty( $group ) )
    25632562            $group =& $groups_template->group;
     2563
     2564        $bp = buddypress();
    25642565
    25652566        return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/accept/' . $group->id ), 'groups_accept_invite' ) );
     
    25802581     */
    25812582    function bp_get_group_reject_invite_link( $group = false ) {
    2582         global $groups_template, $bp;
     2583        global $groups_template;
    25832584
    25842585        if ( empty( $group ) )
    25852586            $group =& $groups_template->group;
     2587
     2588        $bp = buddypress();
    25862589
    25872590        return apply_filters( 'bp_get_group_reject_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ) );
     
    36233626
    36243627function bp_group_creation_tabs() {
    3625     global $bp;
     3628    $bp = buddypress();
    36263629
    36273630    if ( !is_array( $bp->groups->group_creation_steps ) )
     
    36483651
    36493652function bp_group_creation_stage_title() {
    3650     global $bp;
     3653    $bp = buddypress();
    36513654
    36523655    echo apply_filters( 'bp_group_creation_stage_title', '<span>&mdash; ' . $bp->groups->group_creation_steps[bp_get_groups_current_create_step()]['name'] . '</span>' );
     
    36573660}
    36583661    function bp_get_group_creation_form_action() {
    3659         global $bp;
     3662        $bp = buddypress();
    36603663
    36613664        if ( !bp_action_variable( 1 ) ) {
     
    36683671
    36693672function bp_is_group_creation_step( $step_slug ) {
    3670     global $bp;
    36713673
    36723674    /* Make sure we are in the groups component */
    36733675    if ( !bp_is_groups_component() || !bp_is_current_action( 'create' ) )
    36743676        return false;
     3677
     3678    $bp = buddypress();
    36753679
    36763680    /* If this the first step, we can just accept and return true */
     
    36933697
    36943698function bp_is_group_creation_step_complete( $step_slugs ) {
    3695     global $bp;
     3699    $bp = buddypress();
    36963700
    36973701    if ( !isset( $bp->groups->completed_create_steps ) )
     
    37153719
    37163720function bp_are_previous_group_creation_steps_complete( $step_slug ) {
    3717     global $bp;
     3721    $bp = buddypress();
    37183722
    37193723    /* If this is the first group creation step, return true */
     
    37403744}
    37413745    function bp_get_new_group_id() {
    3742         global $bp;
     3746        $bp = buddypress();
    37433747
    37443748        if ( isset( $bp->groups->new_group_id ) )
     
    37543758}
    37553759    function bp_get_new_group_name() {
    3756         global $bp;
     3760        $bp = buddypress();
    37573761
    37583762        if ( isset( $bp->groups->current_group->name ) )
     
    37683772}
    37693773    function bp_get_new_group_description() {
    3770         global $bp;
     3774        $bp = buddypress();
    37713775
    37723776        if ( isset( $bp->groups->current_group->description ) )
     
    37823786}
    37833787    function bp_get_new_group_enable_forum() {
    3784         global $bp;
     3788        $bp = buddypress();
     3789
    37853790        return (int) apply_filters( 'bp_get_new_group_enable_forum', $bp->groups->current_group->enable_forum );
    37863791    }
     
    37903795}
    37913796    function bp_get_new_group_status() {
    3792         global $bp;
     3797        $bp = buddypress();
     3798
    37933799        return apply_filters( 'bp_get_new_group_status', $bp->groups->current_group->status );
    37943800    }
     
    37983804}
    37993805    function bp_get_new_group_avatar( $args = '' ) {
    3800         global $bp;
     3806        $bp = buddypress();
    38013807
    38023808        $defaults = array(
     
    38203826}
    38213827    function bp_get_group_creation_previous_link() {
    3822         global $bp;
     3828        $bp = buddypress();
    38233829
    38243830        foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) {
     
    38493855     */
    38503856    function bp_get_groups_current_create_step() {
    3851         global $bp;
     3857        $bp = buddypress();
    38523858
    38533859        if ( !empty( $bp->groups->current_create_step ) ) {
     
    38613867
    38623868function bp_is_last_group_creation_step() {
    3863     global $bp;
     3869    $bp = buddypress();
    38643870
    38653871    $keys      = array_keys( $bp->groups->group_creation_steps );
     
    38733879
    38743880function bp_is_first_group_creation_step() {
    3875     global $bp;
     3881    $bp = buddypress();
    38763882
    38773883    $keys       = array_keys( $bp->groups->group_creation_steps );
     
    38883894}
    38893895    function bp_get_new_group_invite_friend_list( $args = '' ) {
    3890         global $bp;
     3896        $bp = buddypress();
    38913897
    38923898        if ( !bp_is_active( 'friends' ) )
     
    39453951 */
    39463952function bp_groups_header_tabs() {
    3947     global $bp;?>
     3953    $bp = buddypress(); ?>
    39483954
    39493955    <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() . '/my-groups/recently-active' ) ?>"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
     
    40954101}
    40964102    function bp_get_group_avatar_delete_link() {
    4097         global $bp;
     4103        $bp = buddypress();
    40984104
    40994105        return apply_filters( 'bp_get_group_avatar_delete_link', wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/group-avatar/delete', 'bp_group_avatar_delete' ) );
Note: See TracChangeset for help on using the changeset viewer.