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-blogs/bp-blogs-functions.php

    r9351 r9471  
    1515 * @since BuddyPress (1.5.0)
    1616 *
    17  * @global BuddyPress $bp The one true BuddyPress instance.
    18  *
    1917 * @return bool True if set, false if empty.
    2018 */
    2119function bp_blogs_has_directory() {
    22     global $bp;
     20    $bp = buddypress();
    2321
    2422    return (bool) !empty( $bp->pages->blogs->id );
     
    827825 */
    828826function bp_blogs_remove_blog( $blog_id ) {
    829     global $bp;
    830827
    831828    $blog_id = (int) $blog_id;
     
    844841
    845842    // Delete activity stream item
    846     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
     843    bp_blogs_delete_activity( array(
     844        'item_id'   => $blog_id,
     845        'component' => buddypress()->blogs->id,
     846        'type'      => 'new_blog'
     847    ) );
    847848
    848849    /**
     
    865866 */
    866867function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
    867     global $bp;
    868868
    869869    $blog_id = (int) $blog_id;
     
    885885    bp_blogs_delete_activity( array(
    886886        'item_id'   => $blog_id,
    887         'component' => $bp->blogs->id,
     887        'component' => buddypress()->blogs->id,
    888888        'type'      => 'new_blog'
    889889    ) );
     
    910910 */
    911911function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) {
    912     global $wpdb, $bp;
     912    global $wpdb;
    913913
    914914    if ( empty( $wpdb->blogid ) )
     
    935935
    936936    // Delete activity stream item
    937     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => $bp->blogs->id, 'type' => 'new_blog_post' ) );
     937    bp_blogs_delete_activity( array(
     938        'item_id'           => $blog_id,
     939        'secondary_item_id' => $post_id,
     940        'component'         => buddypress()->blogs->id,
     941        'type'              => 'new_blog_post'
     942    ) );
    938943
    939944    /**
     
    10641069 * @since BuddyPress (1.6.0)
    10651070 *
    1066  * @global object $bp BuddyPress global settings.
    1067  *
    10681071 * @param string $new_status New comment status.
    10691072 * @param string $old_status Previous comment status.
     
    10711074 */
    10721075function bp_blogs_transition_activity_status( $new_status, $old_status, $comment ) {
    1073     global $bp;
    10741076
    10751077    // Check the Activity component is active
     
    11001102    // Get the activity
    11011103    if ( bp_disable_blogforum_comments() ) {
    1102         $activity_id = bp_activity_get_activity_id( array( 'component' => $bp->blogs->id, 'item_id' => get_current_blog_id(), 'secondary_item_id' => $comment->comment_ID, 'type' => 'new_blog_comment', ) );
     1104        $activity_id = bp_activity_get_activity_id( array(
     1105            'component'         => buddypress()->blogs->id,
     1106            'item_id'           => get_current_blog_id(),
     1107            'secondary_item_id' => $comment->comment_ID,
     1108            'type'              => 'new_blog_comment'
     1109        ) );
    11031110    } else {
    11041111        $activity_id = get_comment_meta( $comment->comment_ID, 'bp_activity_comment_id', true );
     
    11891196 */
    11901197function bp_blogs_remove_data_for_blog( $blog_id ) {
    1191     global $bp;
    11921198
    11931199    /**
     
    12051211
    12061212    // Delete activity stream item
    1207     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => false ) );
     1213    bp_blogs_delete_activity( array(
     1214        'item_id'   => $blog_id,
     1215        'component' => buddypress()->blogs->id,
     1216        'type'      => false
     1217    ) );
    12081218
    12091219    /**
     
    12841294 *
    12851295 * @global object $wpdb WordPress database access object.
    1286  * @global object $bp BuddyPress global settings.
    12871296 *
    12881297 * @param int $blog_id ID of the blog whose metadata is being deleted.
     
    12981307 */
    12991308function bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false, $delete_all = false ) {
    1300     global $wpdb, $bp;
     1309    global $wpdb;
    13011310
    13021311    // Legacy - if no meta_key is passed, delete all for the blog_id
     
    13261335 *
    13271336 * @global object $wpdb WordPress database access object.
    1328  * @global object $bp BuddyPress global settings.
    13291337 *
    13301338 * @param int $blog_id ID of the blog whose metadata is being requested.
     
    13491357 *
    13501358 * @global object $wpdb WordPress database access object.
    1351  * @global object $bp BuddyPress global settings.
    13521359 *
    13531360 * @param int $blog_id ID of the blog whose metadata is being updated.
Note: See TracChangeset for help on using the changeset viewer.