Skip to:
Content

BuddyPress.org

Changeset 5302


Ignore:
Timestamp:
11/08/2011 01:24:47 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Use bp_loggedin_user_id() rather than reference the $bp->logged_user->id global var directly. Second step at consolidating user ID checks to use WP_User class later. See #3738.

Location:
trunk
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-functions.php

    r5301 r5302  
    287287    // Fallback to logged in user if no user_id is passed
    288288    if ( empty( $user_id ) )
    289         $user_id = $bp->loggedin_user->id;
     289        $user_id = bp_loggedin_user_id();
    290290
    291291    // Update the user's personal favorites
    292     $my_favs   = bp_get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true );
     292    $my_favs   = bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true );
    293293    $my_favs[] = $activity_id;
    294294
     
    298298
    299299    // Update user meta
    300     bp_update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
     300    bp_update_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', $my_favs );
    301301
    302302    // Update activity meta counts
     
    345345    // Fallback to logged in user if no user_id is passed
    346346    if ( empty( $user_id ) )
    347         $user_id = $bp->loggedin_user->id;
     347        $user_id = bp_loggedin_user_id();
    348348
    349349    // Remove the fav from the user's favs
     
    431431    // Fallback on displayed user, and then logged in user
    432432    if ( empty( $user_id ) )
    433         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     433        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    434434
    435435    return BP_Activity_Activity::total_favorite_count( $user_id );
     
    792792        'primary_link'      => '',    // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
    793793
    794         'user_id'           => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
     794        'user_id'           => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user.
    795795        'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    796796        'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
     
    863863    $defaults = array(
    864864        'content' => false,
    865         'user_id' => $bp->loggedin_user->id
     865        'user_id' => bp_loggedin_user_id()
    866866    );
    867867    $r = wp_parse_args( $args, $defaults );
     
    891891
    892892    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    893     bp_update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     893    bp_update_user_meta( bp_loggedin_user_id(), 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
    894894
    895895    do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
     
    922922        'id'          => false,
    923923        'content'     => false,
    924         'user_id'     => $bp->loggedin_user->id,
     924        'user_id'     => bp_loggedin_user_id(),
    925925        'activity_id' => false, // ID of the root activity item
    926926        'parent_id'   => false  // ID of a parent comment (optional)
     
    10531053    // Check if the user's latest update has been deleted
    10541054    if ( empty( $args['user_id'] ) )
    1055         $user_id = $bp->loggedin_user->id;
     1055        $user_id = bp_loggedin_user_id();
    10561056    else
    10571057        $user_id = $args['user_id'];
  • trunk/bp-activity/bp-activity-screens.php

    r5301 r5302  
    137137    global $bp;
    138138
    139     bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->activity->id, 'new_at_mention' );
     139    bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->activity->id, 'new_at_mention' );
    140140}
    141141add_action( 'bp_activity_screen_my_activity',               'bp_activity_remove_screen_notifications' );
     
    226226
    227227                // User is not a member of group
    228                 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
     228                if ( !groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {
    229229                    $has_access = false;
    230230                }
  • trunk/bp-activity/bp-activity-template.php

    r5301 r5302  
    115115
    116116        // Get an array of the logged in user's favorite activities
    117         $this->my_favs = maybe_unserialize( bp_get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
     117        $this->my_favs = maybe_unserialize( bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true ) );
    118118
    119119        // Fetch specific activity items based on ID's
     
    273273        $primary_id = $bp->groups->current_group->id;
    274274
    275         if ( 'public' != $bp->groups->current_group->status && ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) || $bp->loggedin_user->is_super_admin ) )
     275        if ( 'public' != $bp->groups->current_group->status && ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) || $bp->loggedin_user->is_super_admin ) )
    276276            $show_hidden = true;
    277277    }
     
    325325        // determine which user_id applies
    326326        if ( empty( $user_id ) )
    327             $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     327            $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    328328
    329329        // are we displaying user specific activity?
    330330        if ( is_numeric( $user_id ) ) {
    331             $show_hidden = ( $user_id == $bp->loggedin_user->id && $scope != 'friends' ) ? 1 : 0;
     331            $show_hidden = ( $user_id == bp_loggedin_user_id() && $scope != 'friends' ) ? 1 : 0;
    332332
    333333            switch ( $scope ) {
     
    12251225        $can_delete = true;
    12261226
    1227     if ( $activity->user_id == $bp->loggedin_user->id )
     1227    if ( $activity->user_id == bp_loggedin_user_id() )
    12281228        $can_delete = true;
    12291229
  • trunk/bp-activity/feeds/bp-activity-mygroups-feed.php

    r5109 r5302  
    3535
    3636    <?php
    37         $groups = groups_get_user_groups( $bp->loggedin_user->id );
     37        $groups = groups_get_user_groups( bp_loggedin_user_id() );
    3838        $group_ids = implode( ',', $groups['groups'] );
    3939    ?>
  • trunk/bp-blogs/bp-blogs-activity.php

    r4961 r5302  
    3030
    3131    $defaults = array(
    32         'user_id'           => $bp->loggedin_user->id,
     32        'user_id'           => bp_loggedin_user_id(),
    3333        'action'            => '',
    3434        'content'           => '',
  • trunk/bp-blogs/bp-blogs-buddybar.php

    r4961 r5302  
    1313        return false;
    1414
    15     if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', 'bp' ) ) {
    16         $blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id, true );
    17         wp_cache_set( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp' );
     15    if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' ) ) {
     16        $blogs = bp_blogs_get_blogs_for_user( bp_loggedin_user_id(), true );
     17        wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp' );
    1818    }
    1919
  • trunk/bp-blogs/bp-blogs-classes.php

    r5301 r5302  
    7878        global $bp, $wpdb;
    7979
    80         if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
     80        if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != bp_loggedin_user_id() ) ) )
    8181            $hidden_sql = "AND wb.public = 1";
    8282        else
     
    133133
    134134        if ( !$user_id )
    135             $user_id = $bp->loggedin_user->id;
     135            $user_id = bp_loggedin_user_id();
    136136
    137137        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $user_id, $blog_id ) );
     
    142142
    143143        if ( !$user_id )
    144             $user_id = $bp->loggedin_user->id;
     144            $user_id = bp_loggedin_user_id();
    145145
    146146        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id ) );
     
    195195
    196196        // If the user is logged in return the blog count including their hidden blogs.
    197         if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_super_admin() )
     197        if ( ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) || is_super_admin() )
    198198            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    199199        else
  • trunk/bp-blogs/bp-blogs-functions.php

    r5301 r5302  
    8585
    8686    if ( !$user_id )
    87         $user_id = $bp->loggedin_user->id;
     87        $user_id = bp_loggedin_user_id();
    8888
    8989    $name = get_blog_option( $blog_id, 'blogname' );
     
    377377
    378378    if ( !$user_id )
    379         $user_id = $bp->loggedin_user->id;
     379        $user_id = bp_loggedin_user_id();
    380380
    381381    do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id );
     
    394394    bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'secondary_item_id' => $comment_id, 'type' => 'new_blog_comment' ) );
    395395
    396     do_action( 'bp_blogs_remove_comment', $wpdb->blogid, $comment_id, $bp->loggedin_user->id );
     396    do_action( 'bp_blogs_remove_comment', $wpdb->blogid, $comment_id, bp_loggedin_user_id() );
    397397}
    398398add_action( 'delete_comment', 'bp_blogs_remove_comment' );
     
    411411
    412412    if ( !$user_id )
    413         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     413        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    414414
    415415    if ( !$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ) ) {
  • trunk/bp-core/admin/bp-core-admin.php

    r5223 r5302  
    7373    global $wpdb, $bp;
    7474
    75     $ud = get_userdata( $bp->loggedin_user->id );
     75    $ud = get_userdata( bp_loggedin_user_id() );
    7676
    7777    if ( isset( $_POST['bp-admin-submit'] ) && isset( $_POST['bp-admin'] ) ) {
  • trunk/bp-core/bp-core-classes.php

    r5102 r5302  
    539539        // Fetch whether or not the user is a friend
    540540        if ( bp_is_active( 'friends' ) ) {
    541             $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
     541            $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", bp_loggedin_user_id(), bp_loggedin_user_id() ) );
    542542            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    543543                foreach ( (array)$friend_status as $status ) {
  • trunk/bp-core/bp-core-functions.php

    r5240 r5302  
    702702        return false;
    703703
    704     $user_id = $bp->loggedin_user->id;
     704    $user_id = bp_loggedin_user_id();
    705705
    706706    if ( bp_core_is_user_spammer( $user_id ) || bp_core_is_user_deleted( $user_id ) )
  • trunk/bp-core/bp-core-template.php

    r5301 r5302  
    200200        $youtext = bp_core_ucfirst($youtext);
    201201
    202     if ( bp_displayed_user_id() == $bp->loggedin_user->id ) {
     202    if ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
    203203        if ( $echo )
    204204            echo apply_filters( 'bp_word_or_name', $youtext );
     
    10831083    global $bp;
    10841084
    1085     if ( is_user_logged_in() && $bp->loggedin_user->id == bp_displayed_user_id() )
     1085    if ( is_user_logged_in() && bp_loggedin_user_id() == bp_displayed_user_id() )
    10861086        $my_profile = true;
    10871087    else
  • trunk/bp-forums/bp-forums-functions.php

    r5301 r5302  
    147147        'topic_slug'             => '',
    148148        'topic_text'             => '',
    149         'topic_poster'           => $bp->loggedin_user->id,       // accepts ids
     149        'topic_poster'           => bp_loggedin_user_id(),       // accepts ids
    150150        'topic_poster_name'      => $bp->loggedin_user->fullname, // accept names
    151         'topic_last_poster'      => $bp->loggedin_user->id,       // accepts ids
     151        'topic_last_poster'      => bp_loggedin_user_id(),       // accepts ids
    152152        'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names
    153153        'topic_start_time'       => bp_core_current_time(),
     
    203203
    204204    // Check if the user is a spammer
    205     if ( bp_core_is_user_spammer( $bp->loggedin_user->id ) || bp_core_is_user_deleted( $bp->loggedin_user->id ) )
     205    if ( bp_core_is_user_spammer( bp_loggedin_user_id() ) || bp_core_is_user_deleted( bp_loggedin_user_id() ) )
    206206        return false;
    207207
     
    316316
    317317    if ( !$user_id )
    318         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     318        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    319319
    320320    if ( class_exists( 'BB_Query' ) ) {
     
    488488        'post_text'     => '',
    489489        'post_time'     => bp_core_current_time(),
    490         'poster_id'     => $bp->loggedin_user->id, // accepts ids or names
     490        'poster_id'     => bp_loggedin_user_id(), // accepts ids or names
    491491        'poster_ip'     => $_SERVER['REMOTE_ADDR'],
    492492        'post_status'   => 0, // use bb_delete_post() instead
     
    515515        return false;
    516516
    517     if ( bp_core_is_user_spammer( $bp->loggedin_user->id ) || bp_core_is_user_deleted( $bp->loggedin_user->id ) )
     517    if ( bp_core_is_user_spammer( bp_loggedin_user_id() ) || bp_core_is_user_deleted( bp_loggedin_user_id() ) )
    518518        return false;
    519519
     
    576576    global $bp, $wp_roles, $bb_table_prefix;
    577577
    578     if ( !isset( $bp->loggedin_user->id ) )
     578    if ( !bp_loggedin_user_id() )
    579579        return $allcaps;
    580580
    581     $bb_cap = get_user_meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities', true );
     581    $bb_cap = get_user_meta( bp_loggedin_user_id(), $bb_table_prefix . 'capabilities', true );
    582582
    583583    if ( empty( $bb_cap ) )
  • trunk/bp-forums/bp-forums-screens.php

    r4932 r5302  
    2626            if ( !empty( $bp->groups->current_group->id ) ) {
    2727                // Auto join this user if they are not yet a member of this group
    28                 if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     28                if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
    2929                    groups_join_group( $bp->groups->current_group->id );
    3030
  • trunk/bp-forums/bp-forums-template.php

    r5301 r5302  
    774774        global $bp, $forum_template;
    775775
    776         return $bp->loggedin_user->id == $forum_template->topic->topic_poster;
     776        return bp_loggedin_user_id() == $forum_template->topic->topic_poster;
    777777    }
    778778
     
    12351235        global $bp, $topic_template;
    12361236
    1237         return $bp->loggedin_user->id == $topic_template->post->poster_id;
     1237        return bp_loggedin_user_id() == $topic_template->post->poster_id;
    12381238    }
    12391239
  • trunk/bp-friends/bp-friends-activity.php

    r4961 r5302  
    1515
    1616    $defaults = array (
    17         'user_id'           => $bp->loggedin_user->id,
     17        'user_id'           => bp_loggedin_user_id(),
    1818        'action'            => '',
    1919        'content'           => '',
  • trunk/bp-friends/bp-friends-cache.php

    r4961 r5302  
    2222
    2323    if ( isset( $_GET['new'] ) )
    24         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' );
     24        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->friends->id, 'friendship_accepted' );
    2525}
    2626add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' );
  • trunk/bp-friends/bp-friends-classes.php

    r5301 r5302  
    127127
    128128        if ( !$user_id )
    129             $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     129            $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    130130
    131131        /* This is stored in 'total_friend_count' usermeta.
     
    148148
    149149        if ( !$user_id )
    150             $user_id = $bp->loggedin_user->id;
     150            $user_id = bp_loggedin_user_id();
    151151
    152152        $filter = like_escape( $wpdb->escape( $filter ) );
     
    210210        global $wpdb, $bp;
    211211
    212         return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, $bp->loggedin_user->id ) );
     212        return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) );
    213213    }
    214214
     
    216216        global $wpdb, $bp;
    217217
    218         return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, $bp->loggedin_user->id ) );
     218        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
    219219    }
    220220
  • trunk/bp-friends/bp-friends-functions.php

    r5301 r5302  
    152152
    153153    if ( !$user_id )
    154         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     154        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    155155
    156156    if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) {
     
    211211
    212212    if ( !$user_id )
    213         $user_id = $bp->loggedin_user->id;
     213        $user_id = bp_loggedin_user_id();
    214214
    215215    if ( bp_has_members( 'user_id=' . $user_id . '&type=alphabetical&per_page=0' ) ) {
  • trunk/bp-friends/bp-friends-loader.php

    r5301 r5302  
    147147
    148148            // Pending friend requests
    149             if ( $count = count( friends_get_friendship_request_user_ids( $bp->loggedin_user->id ) ) ) {
     149            if ( $count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) ) ) {
    150150                $title   = sprintf( __( 'Friends <span class="count">%s</span>',          'buddypress' ), $count );
    151151                $pending = sprintf( __( 'Pending Requests <span class="count">%s</span>', 'buddypress' ), $count );
  • trunk/bp-friends/bp-friends-screens.php

    r5301 r5302  
    1313
    1414    // Delete any friendship acceptance notifications for the user when viewing a profile
    15     bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->friends->id, 'friendship_accepted' );
     15    bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->friends->id, 'friendship_accepted' );
    1616
    1717    do_action( 'friends_screen_my_friends' );
  • trunk/bp-friends/bp-friends-template.php

    r5301 r5302  
    291291        $user_id = bp_get_potential_friend_id( $user_id );
    292292
    293     if ( $bp->loggedin_user->id == $user_id )
     293    if ( bp_loggedin_user_id() == $user_id )
    294294        return false;
    295295
    296     return apply_filters( 'bp_is_friend', friends_check_friendship_status( $bp->loggedin_user->id, $user_id ), $user_id );
     296    return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
    297297}
    298298
     
    370370
    371371    if ( !$user_id )
    372         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     372        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    373373
    374374    $friend_ids = friends_get_friend_user_ids( $user_id );
     
    382382    global $bp;
    383383
    384     return apply_filters( 'bp_get_friendship_requests', implode( ',', (array) friends_get_friendship_request_user_ids( $bp->loggedin_user->id ) ) );
     384    return apply_filters( 'bp_get_friendship_requests', implode( ',', (array) friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) ) );
    385385}
    386386
     
    391391        global $members_template, $bp;
    392392
    393         if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
    394             $friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
    395             wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
     393        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     394            $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() );
     395            wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
    396396        }
    397397
     
    405405        global $members_template, $bp;
    406406
    407         if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
    408             $friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
    409             wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
     407        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     408            $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() );
     409            wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
    410410        }
    411411
     
    419419        global $members_template, $bp;
    420420
    421         if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id ) ) {
    422             $friendship_id = friends_get_friendship_id( $members_template->member->id, $bp->loggedin_user->id );
    423             wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp' );
     421        if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
     422            $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() );
     423            wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
    424424        }
    425425
     
    442442
    443443        if ( empty( $user_id ) )
    444             $user_id = $bp->loggedin_user->id;
     444            $user_id = bp_loggedin_user_id();
    445445
    446446        return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) );
  • trunk/bp-groups/bp-groups-actions.php

    r5204 r5302  
    113113
    114114        if ( 'group-invites' == $bp->groups->current_create_step )
    115             groups_send_invites( $bp->loggedin_user->id, $bp->groups->new_group_id );
     115            groups_send_invites( bp_loggedin_user_id(), $bp->groups->new_group_id );
    116116
    117117        do_action( 'groups_create_group_step_save_' . $bp->groups->current_create_step );
     
    139139            // Once we compelete all steps, record the group creation in the activity stream.
    140140            groups_record_activity( array(
    141                 'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
     141                'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
    142142                'type' => 'created_group',
    143143                'item_id' => $bp->groups->new_group_id
     
    208208
    209209    // Skip if banned or already a member
    210     if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) && !groups_is_user_banned( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     210    if ( !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) && !groups_is_user_banned( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    211211
    212212        // User wants to join a group that is not public
    213213        if ( $bp->groups->current_group->status != 'public' ) {
    214             if ( !groups_check_user_has_invite( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     214            if ( !groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    215215                bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
    216216                bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     
    243243
    244244    // User wants to leave any group
    245     if ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     245    if ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    246246
    247247        // Stop sole admins from abandoning their group
    248248        $group_admins = groups_get_group_admins( $bp->groups->current_group->id );
    249         if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == $bp->loggedin_user->id )
     249        if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == bp_loggedin_user_id() )
    250250            bp_core_add_message( __( 'This group must have at least one admin', 'buddypress' ), 'error' );
    251251
     
    308308
    309309    if ( 'public' != $bp->groups->current_group->status ) {
    310         if ( !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     310        if ( !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
    311311            return false;
    312312    }
  • trunk/bp-groups/bp-groups-activity.php

    r4961 r5302  
    4242    $defaults = array (
    4343        'id'                => false,
    44         'user_id'           => $bp->loggedin_user->id,
     44        'user_id'           => bp_loggedin_user_id(),
    4545        'action'            => '',
    4646        'content'           => '',
  • trunk/bp-groups/bp-groups-classes.php

    r5301 r5302  
    4242            $this->last_activity      = $group->last_activity;
    4343            $this->total_member_count = $group->total_member_count;
    44             $this->is_member          = BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $this->id );
     44            $this->is_member          = BP_Groups_Member::check_is_member( bp_loggedin_user_id(), $this->id );
    4545
    4646            // Get group admins and mods
     
    387387        }
    388388
    389         if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
     389        if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != bp_loggedin_user_id() ) ) )
    390390            $hidden_sql = " AND g.status != 'hidden'";
    391391
     
    428428        }
    429429
    430         if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
     430        if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != bp_loggedin_user_id() ) ) )
    431431            $hidden_sql = " AND g.status != 'hidden'";
    432432
     
    505505            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    506506
    507         if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
     507        if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != bp_loggedin_user_id() ) ) )
    508508            $hidden_sql = "AND g.status != 'hidden'";
    509509
     
    543543
    544544        /* Fetch the logged in users status within each group */
    545         $user_status = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_confirmed = 1 AND is_banned = 0", $bp->loggedin_user->id ) );
     545        $user_status = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_confirmed = 1 AND is_banned = 0", bp_loggedin_user_id() ) );
    546546        for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
    547547            $paged_groups[$i]->is_member = false;
     
    553553        }
    554554
    555         $user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", $bp->loggedin_user->id ) );
     555        $user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", bp_loggedin_user_id() ) );
    556556        for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
    557557            $paged_groups[$i]->is_banned = false;
     
    854854
    855855        // If the user is logged in and viewing their own groups, we can show hidden and private groups
    856         if ( $user_id != $bp->loggedin_user->id ) {
     856        if ( $user_id != bp_loggedin_user_id() ) {
    857857            $group_sql = $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0{$pag_sql}", $user_id );
    858858            $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $user_id ) );
     
    880880        }
    881881
    882         if ( $user_id != $bp->loggedin_user->id )
     882        if ( $user_id != bp_loggedin_user_id() )
    883883            $hidden_sql = " AND g.status != 'hidden'";
    884884
     
    902902        }
    903903
    904         if ( $user_id != $bp->loggedin_user->id )
     904        if ( $user_id != bp_loggedin_user_id() )
    905905            $hidden_sql = " AND g.status != 'hidden'";
    906906
     
    924924        }
    925925
    926         if ( $user_id != $bp->loggedin_user->id )
     926        if ( $user_id != bp_loggedin_user_id() )
    927927            $hidden_sql = " AND g.status != 'hidden'";
    928928
     
    939939            $user_id = bp_displayed_user_id();
    940940
    941         if ( $user_id != $bp->loggedin_user->id && !is_super_admin() ) {
     941        if ( $user_id != bp_loggedin_user_id() && !is_super_admin() ) {
    942942            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT m.group_id) FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $user_id ) );
    943943        } else {
     
    11261126
    11271127        if ( bp_is_active( 'friends' ) ) {
    1128             $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
     1128            $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", bp_loggedin_user_id(), bp_loggedin_user_id() ) );
    11291129            for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) {
    11301130                foreach ( (array)$friend_status as $status ) {
  • trunk/bp-groups/bp-groups-forums.php

    r5192 r5302  
    6969        $topic = bp_forums_get_topic_details( $topic_id );
    7070
    71         $activity_action = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
     71        $activity_action = sprintf( __( '%1$s replied to the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    7272        $activity_content = bp_create_excerpt( $post_text );
    7373        $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/';
     
    108108        $topic = bp_forums_get_topic_details( $topic_id );
    109109
    110         $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
     110        $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( bp_loggedin_user_id() ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    111111        $activity_content = bp_create_excerpt( $topic_text );
    112112
  • trunk/bp-groups/bp-groups-functions.php

    r5301 r5302  
    6363        $group->creator_id = $creator_id;
    6464    else
    65         $group->creator_id = $bp->loggedin_user->id;
     65        $group->creator_id = bp_loggedin_user_id();
    6666
    6767    if ( isset( $name ) )
     
    248248
    249249    if ( !$user_id )
    250         $user_id = $bp->loggedin_user->id;
     250        $user_id = bp_loggedin_user_id();
    251251
    252252    // Don't let single admins leave the group.
     
    289289
    290290    if ( !$user_id )
    291         $user_id = $bp->loggedin_user->id;
     291        $user_id = bp_loggedin_user_id();
    292292
    293293    // Check if the user has an outstanding invite, is so delete it.
     
    407407
    408408    if ( !$user_id )
    409         $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     409        $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    410410
    411411    if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) {
     
    491491    $defaults = array(
    492492        'content'  => false,
    493         'user_id'  => $bp->loggedin_user->id,
     493        'user_id'  => bp_loggedin_user_id(),
    494494        'group_id' => 0
    495495    );
     
    534534
    535535    if ( !$user_id )
    536         $user_id = $bp->loggedin_user->id;
     536        $user_id = bp_loggedin_user_id();
    537537
    538538    return BP_Groups_Member::get_invites( $user_id, $limit, $page, $exclude );
     
    545545        'user_id'       => false,
    546546        'group_id'      => false,
    547         'inviter_id'    => $bp->loggedin_user->id,
     547        'inviter_id'    => bp_loggedin_user_id(),
    548548        'date_modified' => bp_core_current_time(),
    549549        'is_confirmed'  => 0
     
    634634
    635635    if ( !$user_id )
    636         $user_id = $bp->loggedin_user->id;
     636        $user_id = bp_loggedin_user_id();
    637637
    638638    // Send friend invites.
  • trunk/bp-groups/bp-groups-loader.php

    r5301 r5302  
    107107                bp_update_is_item_admin( true, 'groups' );
    108108            else
    109                 bp_update_is_item_admin( groups_is_user_admin( $bp->loggedin_user->id, $this->current_group->id ), 'groups' );
     109                bp_update_is_item_admin( groups_is_user_admin( bp_loggedin_user_id(), $this->current_group->id ), 'groups' );
    110110
    111111            // If the user is not an admin, check if they are a moderator
    112112            if ( !bp_is_item_admin() )
    113                 bp_update_is_item_mod  ( groups_is_user_mod  ( $bp->loggedin_user->id, $this->current_group->id ), 'groups' );
     113                bp_update_is_item_mod  ( groups_is_user_mod  ( bp_loggedin_user_id(), $this->current_group->id ), 'groups' );
    114114
    115115            // Is the logged in user a member of the group?
    116             if ( ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $this->current_group->id ) ) )
     116            if ( ( is_user_logged_in() && groups_is_user_member( bp_loggedin_user_id(), $this->current_group->id ) ) )
    117117                $this->current_group->is_user_member = true;
    118118            else
     
    314314                 !is_super_admin() &&
    315315                 !$this->current_group->is_user_member &&
    316                  !groups_check_for_membership_request( $bp->loggedin_user->id, $this->current_group->id ) &&
     316                 !groups_check_for_membership_request( bp_loggedin_user_id(), $this->current_group->id ) &&
    317317                 $this->current_group->status == 'private'
    318318                ) {
     
    393393
    394394            // Pending group invites
    395             $count = groups_get_invites_for_user( $bp->loggedin_user->id );
     395            $count = groups_get_invites_for_user( bp_loggedin_user_id() );
    396396
    397397            if ( !empty( $count->total ) ) {
  • trunk/bp-groups/bp-groups-screens.php

    r5301 r5302  
    2727    // Delete group request notifications for the user
    2828    if ( isset( $_GET['n'] ) ) {
    29         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_accepted' );
    30         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_rejected' );
    31         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_mod'      );
    32         bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_admin'    );
     29        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
     30        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
     31        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
     32        bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
    3333    }
    3434
     
    8989    if ( bp_is_single_item() ) {
    9090        if ( isset( $_GET['n'] ) ) {
    91             bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_accepted' );
    92             bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'membership_request_rejected' );
    93             bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_mod'      );
    94             bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->groups->id, 'member_promoted_to_admin'    );
     91            bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_accepted' );
     92            bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'membership_request_rejected' );
     93            bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_mod'      );
     94            bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->groups->id, 'member_promoted_to_admin'    );
    9595        }
    9696
     
    130130        $user_is_banned = false;
    131131
    132         if ( !is_super_admin() && groups_is_user_banned( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     132        if ( !is_super_admin() && groups_is_user_banned( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
    133133            $user_is_banned = true;
    134134
     
    141141
    142142                // Auto join this user if they are not yet a member of this group
    143                 if ( bp_groups_auto_join() && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
    144                     groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
     143                if ( bp_groups_auto_join() && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
     144                    groups_join_group( $bp->groups->current_group->id, bp_loggedin_user_id() );
    145145
    146146                $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false;
     
    219219
    220220                /* Check the logged in user can delete this topic */
    221                 if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$topic->topic_poster )
     221                if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)bp_loggedin_user_id() != (int)$topic->topic_poster )
    222222                    bp_core_redirect( wp_get_referer() );
    223223
     
    242242
    243243                // Check the logged in user can edit this topic
    244                 if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$topic->topic_poster )
     244                if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)bp_loggedin_user_id() != (int)$topic->topic_poster )
    245245                    bp_core_redirect( wp_get_referer() );
    246246
     
    269269
    270270                // Check the logged in user can edit this topic
    271                 if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$post->poster_id )
     271                if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)bp_loggedin_user_id() != (int)$post->poster_id )
    272272                    bp_core_redirect( wp_get_referer() );
    273273
     
    292292
    293293                // Check the logged in user can edit this topic
    294                 if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$post->poster_id )
     294                if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)bp_loggedin_user_id() != (int)$post->poster_id )
    295295                    bp_core_redirect( wp_get_referer() );
    296296
     
    338338                    $error_message = __( "You have been banned from this group.", 'buddypress' );
    339339
    340                 } elseif ( bp_groups_auto_join() && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     340                } elseif ( bp_groups_auto_join() && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    341341                    // Auto join this user if they are not yet a member of this group
    342                     groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
     342                    groups_join_group( $bp->groups->current_group->id, bp_loggedin_user_id() );
    343343                }
    344344
     
    402402
    403403            // Send the invites.
    404             groups_send_invites( $bp->loggedin_user->id, $bp->groups->current_group->id );
     404            groups_send_invites( bp_loggedin_user_id(), $bp->groups->current_group->id );
    405405            bp_core_add_message( __('Group invites sent.', 'buddypress') );
    406406            do_action( 'groups_screen_group_invite', $bp->groups->current_group->id );
     
    430430                return false;
    431431
    432             if ( !groups_send_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     432            if ( !groups_send_membership_request( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    433433                bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );
    434434            } else {
  • trunk/bp-groups/bp-groups-template.php

    r5301 r5302  
    111111        $this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    112112
    113         if ( $bp->loggedin_user->is_super_admin || ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) )
     113        if ( $bp->loggedin_user->is_super_admin || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) )
    114114            $show_hidden = true;
    115115
     
    309309        return true;
    310310    } else {
    311         if ( groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
     311        if ( groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {
    312312            return true;
    313313        }
     
    13941394
    13951395    if ( !$user_id )
    1396         $user_id = $bp->loggedin_user->id;
     1396        $user_id = bp_loggedin_user_id();
    13971397
    13981398    return apply_filters( 'bp_group_is_user_banned', groups_is_user_banned( $user_id, $group->id ) );
     
    14681468        $group =& $groups_template->group;
    14691469
    1470     if ( !friends_check_user_has_friends( $bp->loggedin_user->id ) || !friends_count_invitable_friends( $bp->loggedin_user->id, $group->id ) )
     1470    if ( !friends_check_user_has_friends( bp_loggedin_user_id() ) || !friends_count_invitable_friends( bp_loggedin_user_id(), $group->id ) )
    14711471        return false;
    14721472
     
    15241524            // Stop sole admins from abandoning their group
    15251525            $group_admins = groups_get_group_admins( $group->id );
    1526             if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == $bp->loggedin_user->id )
     1526            if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == bp_loggedin_user_id() )
    15271527                return false;
    15281528
     
    22282228            $group_id = !empty( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    22292229
    2230         if ( $friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_id ) ) {
    2231             $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_id );
     2230        if ( $friends = friends_get_friends_invite_list( bp_loggedin_user_id(), $group_id ) ) {
     2231            $invites = groups_get_invites_for_group( bp_loggedin_user_id(), $group_id );
    22322232
    22332233            for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
     
    26402640    $defaults = array(
    26412641        'group_id' => false,
    2642         'user_id' => $bp->loggedin_user->id
     2642        'user_id' => bp_loggedin_user_id()
    26432643    );
    26442644
  • trunk/bp-members/bp-members-adminbar.php

    r5301 r5302  
    3030        // User avatar
    3131        $avatar = bp_core_fetch_avatar( array(
    32             'item_id' => $bp->loggedin_user->id,
     32            'item_id' => bp_loggedin_user_id(),
    3333            'email'   => $bp->loggedin_user->userdata->user_email,
    3434            'width'   => 16,
  • trunk/bp-members/bp-members-buddybar.php

    r5301 r5302  
    1313    _e( 'Notifications', 'buddypress' );
    1414
    15     if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
     15    if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() ) ) { ?>
    1616        <span><?php echo count( $notifications ) ?></span>
    1717    <?php
  • trunk/bp-members/bp-members-functions.php

    r5301 r5302  
    214214
    215215            // User ID matches logged in user
    216             if ( isset( $bp->loggedin_user->id ) && $bp->loggedin_user->id == $user_id ) {
     216            if ( bp_loggedin_user_id() == $user_id ) {
    217217                $userdata = &$bp->loggedin_user->userdata;
    218218
     
    286286
    287287        // User ID matches logged in user
    288         if ( isset( $bp->loggedin_user->id ) && $bp->loggedin_user->id == $user_id ) {
     288        if ( bp_loggedin_user_id() == $user_id ) {
    289289            $userdata = &$bp->loggedin_user->userdata;
    290290
     
    594594
    595595    if ( !$user_id )
    596         $user_id = $bp->loggedin_user->id;
     596        $user_id = bp_loggedin_user_id();
    597597
    598598    // Make sure account deletion is not disabled
  • trunk/bp-members/bp-members-loader.php

    r5301 r5302  
    7676
    7777        // Fetch the full name for the logged in user
    78         $bp->loggedin_user->fullname       = bp_core_get_user_displayname( $bp->loggedin_user->id );
     78        $bp->loggedin_user->fullname       = bp_core_get_user_displayname( bp_loggedin_user_id() );
    7979
    8080        // Hits the DB on single WP installs so get this separately
     
    8282
    8383        // The domain for the user currently logged in. eg: http://domain.com/members/andy
    84         $bp->loggedin_user->domain         = bp_core_get_user_domain( $bp->loggedin_user->id );
     84        $bp->loggedin_user->domain         = bp_core_get_user_domain( bp_loggedin_user_id() );
    8585
    8686        // The core userdata of the user who is currently logged in.
    87         $bp->loggedin_user->userdata       = bp_core_get_core_userdata( $bp->loggedin_user->id );
     87        $bp->loggedin_user->userdata       = bp_core_get_core_userdata( bp_loggedin_user_id() );
    8888
    8989        /** Displayed user ****************************************************/
  • trunk/bp-members/bp-members-notifications.php

    r4961 r5302  
    3636
    3737function bp_core_delete_notification( $id ) {
    38     if ( !bp_core_check_notification_access( $bp->loggedin_user->id, $id ) )
     38    if ( !bp_core_check_notification_access( bp_loggedin_user_id(), $id ) )
    3939        return false;
    4040
  • trunk/bp-members/bp-members-template.php

    r5301 r5302  
    467467function bp_member_is_loggedin_user() {
    468468    global $bp, $members_template;
    469     return apply_filters( 'bp_member_is_loggedin_user', $bp->loggedin_user->id == $members_template->member->id ? true : false );
     469    return apply_filters( 'bp_member_is_loggedin_user', bp_loggedin_user_id() == $members_template->member->id ? true : false );
    470470}
    471471
     
    721721            if ( bp_is_active( 'friends' ) ) {
    722722                if ( $nav_item['css_id'] == $bp->friends->id ) {
    723                     if ( friends_check_friendship( $bp->loggedin_user->id, bp_displayed_user_id() ) )
     723                    if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) )
    724724                        $selected = ' class="current selected"';
    725725                }
     
    784784        extract( $r, EXTR_SKIP );
    785785
    786         return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) );
     786        return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => bp_loggedin_user_id(), 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html, 'alt' => $alt ) ) );
    787787    }
    788788
     
    881881    return apply_filters( 'bp_displayed_user_id', $id );
    882882}
    883     function bp_current_user_id() { return bp_displayed_user_id(); }
    884883
    885884function bp_loggedin_user_id() {
     
    894893    return apply_filters( 'bp_loggedin_user_id', $id );
    895894}
     895
     896function bp_current_user_id() { return bp_loggedin_user_id(); }
    896897
    897898function bp_displayed_user_domain() {
     
    944945        global $bp;
    945946
    946         if ( !empty( $bp->loggedin_user->id ) ) {
    947             $username = bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );
     947        if ( bp_loggedin_user_id() ) {
     948            $username = bp_core_get_username( bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );
    948949        } else {
    949950            $username = '';
  • trunk/bp-messages/bp-messages-classes.php

    r4961 r5302  
    3939
    4040        // Get the unread count for the logged in user
    41         if ( isset( $this->recipients[$bp->loggedin_user->id] ) )
    42             $this->unread_count = $this->recipients[$bp->loggedin_user->id]->unread_count;
     41        if ( isset( $this->recipients[bp_loggedin_user_id()] ) )
     42            $this->unread_count = $this->recipients[bp_loggedin_user_id()]->unread_count;
    4343    }
    4444
     
    6767        global $wpdb, $bp;
    6868
    69         $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp->loggedin_user->id ) );
     69        $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) );
    7070
    7171        // Check to see if any more recipients remain for this message
     
    123123        global $wpdb, $bp;
    124124
    125         $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
     125        $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", bp_loggedin_user_id(), $thread_id );
    126126        $wpdb->query($sql);
    127127    }
     
    130130        global $wpdb, $bp;
    131131
    132         $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $bp->loggedin_user->id, $thread_id );
     132        $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", bp_loggedin_user_id(), $thread_id );
    133133        $wpdb->query($sql);
    134134    }
     
    157157            return false;
    158158
    159         return in_array( $bp->loggedin_user->id, $sender_ids );
     159        return in_array( bp_loggedin_user_id(), $sender_ids );
    160160    }
    161161
     
    173173
    174174        if ( empty( $user_id ) )
    175             $user_id = $bp->loggedin_user->id;
     175            $user_id = bp_loggedin_user_id();
    176176
    177177        $sql = $wpdb->prepare( "SELECT SUM(unread_count) FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0 AND sender_only = 0", $user_id );
     
    188188
    189189        if ( empty( $user_id ) )
    190             $user_id = $bp->loggedin_user->id;
     190            $user_id = bp_loggedin_user_id();
    191191
    192192        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND user_id = %d", $thread_id, $user_id ) );
     
    259259
    260260        $this->date_sent = bp_core_current_time();
    261         $this->sender_id = $bp->loggedin_user->id;
     261        $this->sender_id = bp_loggedin_user_id();
    262262
    263263        if ( !empty( $id ) )
     
    355355        global $wpdb, $bp;
    356356
    357         return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", $bp->loggedin_user->id, $thread_id ) );
     357        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", bp_loggedin_user_id(), $thread_id ) );
    358358    }
    359359
     
    422422        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
    423423
    424         bp_update_user_meta( $bp->loggedin_user->id, 'last_activity', bp_core_current_time() );
     424        bp_update_user_meta( bp_loggedin_user_id(), 'last_activity', bp_core_current_time() );
    425425
    426426        do_action_ref_array( 'messages_notice_after_save', array( &$this ) );
  • trunk/bp-messages/bp-messages-functions.php

    r4961 r5302  
    1414
    1515    $defaults = array (
    16         'sender_id'  => $bp->loggedin_user->id,
     16        'sender_id'  => bp_loggedin_user_id(),
    1717        'thread_id'  => false, // false for a new message, thread id for a reply to a thread.
    1818        'recipients' => false, // Can be an array of usernames, user_ids or mixed.
     
    168168
    169169    if ( empty( $user_id ) )
    170         $user_id = $bp->loggedin_user->id;
     170        $user_id = bp_loggedin_user_id();
    171171
    172172    return BP_Messages_Thread::check_access( $thread_id, $user_id );
     
    197197
    198198    if ( empty( $user_id ) )
    199         $user_id = $bp->loggedin_user->id;
     199        $user_id = bp_loggedin_user_id();
    200200
    201201    return BP_Messages_Thread::get_inbox_count( $user_id );
  • trunk/bp-messages/bp-messages-template.php

    r5301 r5302  
    128128                if ( 'inbox' == $this->box ) {
    129129                    foreach ( (array)$this->thread->messages as $key => $message ) {
    130                         if ( $bp->loggedin_user->id != $message->sender_id ) {
     130                        if ( bp_loggedin_user_id() != $message->sender_id ) {
    131131                            $last_message_index = $key;
    132132                            break;
     
    136136                } elseif ( 'sentbox' == $this->box ) {
    137137                    foreach ( (array)$this->thread->messages as $key => $message ) {
    138                         if ( $bp->loggedin_user->id == $message->sender_id ) {
     138                        if ( bp_loggedin_user_id() == $message->sender_id ) {
    139139                            $last_message_index = $key;
    140140                            break;
     
    160160
    161161    $defaults = array(
    162         'user_id' => $bp->loggedin_user->id,
     162        'user_id' => bp_loggedin_user_id(),
    163163        'box' => 'inbox',
    164164        'per_page' => 10,
     
    174174    } else {
    175175        if ( 'inbox' == $bp->current_action )
    176             bp_core_delete_notifications_by_type( $bp->loggedin_user->id, $bp->messages->id, 'new_message' );
     176            bp_core_delete_notifications_by_type( bp_loggedin_user_id(), $bp->messages->id, 'new_message' );
    177177
    178178        if ( 'sentbox' == $bp->current_action )
     
    781781
    782782        foreach( (array)$thread_template->thread->recipients as $recipient ) {
    783             if ( $recipient->user_id !== $bp->loggedin_user->id )
     783            if ( $recipient->user_id !== bp_loggedin_user_id() )
    784784                $recipient_links[] = bp_core_get_userlink( $recipient->user_id );
    785785        }
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r5301 r5302  
    4040    if ( !empty( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) {
    4141        if ( 'personal' == $_BP_COOKIE['bp-' . $object . '-scope'] ) {
    42             $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : $bp->loggedin_user->id;
     42            $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    4343            $qs[] = 'user_id=' . $user_id;
    4444        }
     
    126126        case 'mentions':
    127127            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
    128             bp_activity_clear_new_mentions( $bp->loggedin_user->id );
     128            bp_activity_clear_new_mentions( bp_loggedin_user_id() );
    129129            break;
    130130        default:
     
    298298
    299299    /* Check access */
    300     if ( !is_super_admin() && $comment->user_id != $bp->loggedin_user->id )
     300    if ( !is_super_admin() && $comment->user_id != bp_loggedin_user_id() )
    301301        return false;
    302302
     
    424424        return false;
    425425
    426     if ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) )
     426    if ( !friends_check_friendship( bp_loggedin_user_id(), $_POST['friend_id'] ) )
    427427        return false;
    428428
     
    460460    global $bp;
    461461
    462     if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
     462    if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
    463463
    464464        check_ajax_referer('friends_remove_friend');
    465465
    466         if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
     466        if ( !friends_remove_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
    467467            echo __("Friendship could not be canceled.", 'buddypress');
    468468        } else {
     
    470470        }
    471471
    472     } else if ( 'not_friends' == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
     472    } else if ( 'not_friends' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
    473473
    474474        check_ajax_referer('friends_add_friend');
    475475
    476         if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {
     476        if ( !friends_add_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) {
    477477            echo __("Friendship could not be requested.", 'buddypress');
    478478        } else {
     
    513513    global $bp;
    514514
    515     if ( groups_is_user_banned( $bp->loggedin_user->id, $_POST['gid'] ) )
     515    if ( groups_is_user_banned( bp_loggedin_user_id(), $_POST['gid'] ) )
    516516        return false;
    517517
     
    519519        return false;
    520520
    521     if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {
     521    if ( !groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) {
    522522
    523523        if ( 'public' == $group->status ) {
     
    535535            check_ajax_referer( 'groups_request_membership' );
    536536
    537             if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {
     537            if ( !groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) {
    538538                _e( 'Error requesting membership', 'buddypress' );
    539539            } else {
     
    688688            $user_ids = array();
    689689            foreach( $users['users'] as $user ) {
    690                 if ( $user->id != $bp->loggedin_user->id )
     690                if ( $user->id != bp_loggedin_user_id() )
    691691                    $user_ids[] = $user->id;
    692692            }
     
    696696    } else {
    697697        if ( bp_is_active( 'friends' ) ) {
    698             $users = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $limit, 1 );
     698            $users = friends_search_friends( $_GET['q'], bp_loggedin_user_id(), $limit, 1 );
    699699
    700700            // Keeping the bp_friends_autocomplete_list filter for backward compatibility
  • trunk/bp-xprofile/bp-xprofile-activity.php

    r5301 r5302  
    4343
    4444    $defaults = array (
    45         'user_id'           => $bp->loggedin_user->id,
     45        'user_id'           => bp_loggedin_user_id(),
    4646        'action'            => '',
    4747        'content'           => '',
  • trunk/bp-xprofile/bp-xprofile-cache.php

    r4961 r5302  
    1717function xprofile_clear_profile_data_object_cache( $group_id ) {
    1818    global $bp;
    19     wp_cache_delete( 'bp_user_fullname_' . $bp->loggedin_user->id, 'bp' );
     19    wp_cache_delete( 'bp_user_fullname_' . bp_loggedin_user_id(), 'bp' );
    2020}
    2121
  • trunk/bp-xprofile/bp-xprofile-functions.php

    r5301 r5302  
    392392
    393393    if ( empty( $user_id ) )
    394         $user_id = $bp->loggedin_user->id;
     394        $user_id = bp_loggedin_user_id();
    395395
    396396    if ( empty( $user_id ) )
Note: See TracChangeset for help on using the changeset viewer.