Changeset 5302
- Timestamp:
- 11/08/2011 01:24:47 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-functions.php
r5301 r5302 287 287 // Fallback to logged in user if no user_id is passed 288 288 if ( empty( $user_id ) ) 289 $user_id = $bp->loggedin_user->id;289 $user_id = bp_loggedin_user_id(); 290 290 291 291 // 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 ); 293 293 $my_favs[] = $activity_id; 294 294 … … 298 298 299 299 // 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 ); 301 301 302 302 // Update activity meta counts … … 345 345 // Fallback to logged in user if no user_id is passed 346 346 if ( empty( $user_id ) ) 347 $user_id = $bp->loggedin_user->id;347 $user_id = bp_loggedin_user_id(); 348 348 349 349 // Remove the fav from the user's favs … … 431 431 // Fallback on displayed user, and then logged in user 432 432 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(); 434 434 435 435 return BP_Activity_Activity::total_favorite_count( $user_id ); … … 792 792 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 793 793 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. 795 795 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id 796 796 'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id … … 863 863 $defaults = array( 864 864 'content' => false, 865 'user_id' => $bp->loggedin_user->id865 'user_id' => bp_loggedin_user_id() 866 866 ); 867 867 $r = wp_parse_args( $args, $defaults ); … … 891 891 892 892 // 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 ) ) ); 894 894 895 895 do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id ); … … 922 922 'id' => false, 923 923 'content' => false, 924 'user_id' => $bp->loggedin_user->id,924 'user_id' => bp_loggedin_user_id(), 925 925 'activity_id' => false, // ID of the root activity item 926 926 'parent_id' => false // ID of a parent comment (optional) … … 1053 1053 // Check if the user's latest update has been deleted 1054 1054 if ( empty( $args['user_id'] ) ) 1055 $user_id = $bp->loggedin_user->id;1055 $user_id = bp_loggedin_user_id(); 1056 1056 else 1057 1057 $user_id = $args['user_id']; -
trunk/bp-activity/bp-activity-screens.php
r5301 r5302 137 137 global $bp; 138 138 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' ); 140 140 } 141 141 add_action( 'bp_activity_screen_my_activity', 'bp_activity_remove_screen_notifications' ); … … 226 226 227 227 // 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 ) ) { 229 229 $has_access = false; 230 230 } -
trunk/bp-activity/bp-activity-template.php
r5301 r5302 115 115 116 116 // 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 ) ); 118 118 119 119 // Fetch specific activity items based on ID's … … 273 273 $primary_id = $bp->groups->current_group->id; 274 274 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 ) ) 276 276 $show_hidden = true; 277 277 } … … 325 325 // determine which user_id applies 326 326 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(); 328 328 329 329 // are we displaying user specific activity? 330 330 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; 332 332 333 333 switch ( $scope ) { … … 1225 1225 $can_delete = true; 1226 1226 1227 if ( $activity->user_id == $bp->loggedin_user->id)1227 if ( $activity->user_id == bp_loggedin_user_id() ) 1228 1228 $can_delete = true; 1229 1229 -
trunk/bp-activity/feeds/bp-activity-mygroups-feed.php
r5109 r5302 35 35 36 36 <?php 37 $groups = groups_get_user_groups( $bp->loggedin_user->id);37 $groups = groups_get_user_groups( bp_loggedin_user_id() ); 38 38 $group_ids = implode( ',', $groups['groups'] ); 39 39 ?> -
trunk/bp-blogs/bp-blogs-activity.php
r4961 r5302 30 30 31 31 $defaults = array( 32 'user_id' => $bp->loggedin_user->id,32 'user_id' => bp_loggedin_user_id(), 33 33 'action' => '', 34 34 'content' => '', -
trunk/bp-blogs/bp-blogs-buddybar.php
r4961 r5302 13 13 return false; 14 14 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' ); 18 18 } 19 19 -
trunk/bp-blogs/bp-blogs-classes.php
r5301 r5302 78 78 global $bp, $wpdb; 79 79 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() ) ) ) 81 81 $hidden_sql = "AND wb.public = 1"; 82 82 else … … 133 133 134 134 if ( !$user_id ) 135 $user_id = $bp->loggedin_user->id;135 $user_id = bp_loggedin_user_id(); 136 136 137 137 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d AND blog_id = %d", $user_id, $blog_id ) ); … … 142 142 143 143 if ( !$user_id ) 144 $user_id = $bp->loggedin_user->id;144 $user_id = bp_loggedin_user_id(); 145 145 146 146 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id ) ); … … 195 195 196 196 // 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() ) 198 198 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) ); 199 199 else -
trunk/bp-blogs/bp-blogs-functions.php
r5301 r5302 85 85 86 86 if ( !$user_id ) 87 $user_id = $bp->loggedin_user->id;87 $user_id = bp_loggedin_user_id(); 88 88 89 89 $name = get_blog_option( $blog_id, 'blogname' ); … … 377 377 378 378 if ( !$user_id ) 379 $user_id = $bp->loggedin_user->id;379 $user_id = bp_loggedin_user_id(); 380 380 381 381 do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id ); … … 394 394 bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'secondary_item_id' => $comment_id, 'type' => 'new_blog_comment' ) ); 395 395 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() ); 397 397 } 398 398 add_action( 'delete_comment', 'bp_blogs_remove_comment' ); … … 411 411 412 412 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(); 414 414 415 415 if ( !$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ) ) { -
trunk/bp-core/admin/bp-core-admin.php
r5223 r5302 73 73 global $wpdb, $bp; 74 74 75 $ud = get_userdata( $bp->loggedin_user->id);75 $ud = get_userdata( bp_loggedin_user_id() ); 76 76 77 77 if ( isset( $_POST['bp-admin-submit'] ) && isset( $_POST['bp-admin'] ) ) { -
trunk/bp-core/bp-core-classes.php
r5102 r5302 539 539 // Fetch whether or not the user is a friend 540 540 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() ) ); 542 542 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 543 543 foreach ( (array)$friend_status as $status ) { -
trunk/bp-core/bp-core-functions.php
r5240 r5302 702 702 return false; 703 703 704 $user_id = $bp->loggedin_user->id;704 $user_id = bp_loggedin_user_id(); 705 705 706 706 if ( bp_core_is_user_spammer( $user_id ) || bp_core_is_user_deleted( $user_id ) ) -
trunk/bp-core/bp-core-template.php
r5301 r5302 200 200 $youtext = bp_core_ucfirst($youtext); 201 201 202 if ( bp_displayed_user_id() == $bp->loggedin_user->id) {202 if ( bp_displayed_user_id() == bp_loggedin_user_id() ) { 203 203 if ( $echo ) 204 204 echo apply_filters( 'bp_word_or_name', $youtext ); … … 1083 1083 global $bp; 1084 1084 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() ) 1086 1086 $my_profile = true; 1087 1087 else -
trunk/bp-forums/bp-forums-functions.php
r5301 r5302 147 147 'topic_slug' => '', 148 148 'topic_text' => '', 149 'topic_poster' => $bp->loggedin_user->id, // accepts ids149 'topic_poster' => bp_loggedin_user_id(), // accepts ids 150 150 'topic_poster_name' => $bp->loggedin_user->fullname, // accept names 151 'topic_last_poster' => $bp->loggedin_user->id, // accepts ids151 'topic_last_poster' => bp_loggedin_user_id(), // accepts ids 152 152 'topic_last_poster_name' => $bp->loggedin_user->fullname, // accept names 153 153 'topic_start_time' => bp_core_current_time(), … … 203 203 204 204 // 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() ) ) 206 206 return false; 207 207 … … 316 316 317 317 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(); 319 319 320 320 if ( class_exists( 'BB_Query' ) ) { … … 488 488 'post_text' => '', 489 489 'post_time' => bp_core_current_time(), 490 'poster_id' => $bp->loggedin_user->id, // accepts ids or names490 'poster_id' => bp_loggedin_user_id(), // accepts ids or names 491 491 'poster_ip' => $_SERVER['REMOTE_ADDR'], 492 492 'post_status' => 0, // use bb_delete_post() instead … … 515 515 return false; 516 516 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() ) ) 518 518 return false; 519 519 … … 576 576 global $bp, $wp_roles, $bb_table_prefix; 577 577 578 if ( ! isset( $bp->loggedin_user->id) )578 if ( !bp_loggedin_user_id() ) 579 579 return $allcaps; 580 580 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 ); 582 582 583 583 if ( empty( $bb_cap ) ) -
trunk/bp-forums/bp-forums-screens.php
r4932 r5302 26 26 if ( !empty( $bp->groups->current_group->id ) ) { 27 27 // 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 ) ) 29 29 groups_join_group( $bp->groups->current_group->id ); 30 30 -
trunk/bp-forums/bp-forums-template.php
r5301 r5302 774 774 global $bp, $forum_template; 775 775 776 return $bp->loggedin_user->id== $forum_template->topic->topic_poster;776 return bp_loggedin_user_id() == $forum_template->topic->topic_poster; 777 777 } 778 778 … … 1235 1235 global $bp, $topic_template; 1236 1236 1237 return $bp->loggedin_user->id== $topic_template->post->poster_id;1237 return bp_loggedin_user_id() == $topic_template->post->poster_id; 1238 1238 } 1239 1239 -
trunk/bp-friends/bp-friends-activity.php
r4961 r5302 15 15 16 16 $defaults = array ( 17 'user_id' => $bp->loggedin_user->id,17 'user_id' => bp_loggedin_user_id(), 18 18 'action' => '', 19 19 'content' => '', -
trunk/bp-friends/bp-friends-cache.php
r4961 r5302 22 22 23 23 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' ); 25 25 } 26 26 add_action( 'bp_activity_screen_my_activity', 'friends_clear_friend_notifications' ); -
trunk/bp-friends/bp-friends-classes.php
r5301 r5302 127 127 128 128 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(); 130 130 131 131 /* This is stored in 'total_friend_count' usermeta. … … 148 148 149 149 if ( !$user_id ) 150 $user_id = $bp->loggedin_user->id;150 $user_id = bp_loggedin_user_id(); 151 151 152 152 $filter = like_escape( $wpdb->escape( $filter ) ); … … 210 210 global $wpdb, $bp; 211 211 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() ) ); 213 213 } 214 214 … … 216 216 global $wpdb, $bp; 217 217 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() ) ); 219 219 } 220 220 -
trunk/bp-friends/bp-friends-functions.php
r5301 r5302 152 152 153 153 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(); 155 155 156 156 if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) { … … 211 211 212 212 if ( !$user_id ) 213 $user_id = $bp->loggedin_user->id;213 $user_id = bp_loggedin_user_id(); 214 214 215 215 if ( bp_has_members( 'user_id=' . $user_id . '&type=alphabetical&per_page=0' ) ) { -
trunk/bp-friends/bp-friends-loader.php
r5301 r5302 147 147 148 148 // 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() ) ) ) { 150 150 $title = sprintf( __( 'Friends <span class="count">%s</span>', 'buddypress' ), $count ); 151 151 $pending = sprintf( __( 'Pending Requests <span class="count">%s</span>', 'buddypress' ), $count ); -
trunk/bp-friends/bp-friends-screens.php
r5301 r5302 13 13 14 14 // 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' ); 16 16 17 17 do_action( 'friends_screen_my_friends' ); -
trunk/bp-friends/bp-friends-template.php
r5301 r5302 291 291 $user_id = bp_get_potential_friend_id( $user_id ); 292 292 293 if ( $bp->loggedin_user->id== $user_id )293 if ( bp_loggedin_user_id() == $user_id ) 294 294 return false; 295 295 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 ); 297 297 } 298 298 … … 370 370 371 371 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(); 373 373 374 374 $friend_ids = friends_get_friend_user_ids( $user_id ); … … 382 382 global $bp; 383 383 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() ) ) ); 385 385 } 386 386 … … 391 391 global $members_template, $bp; 392 392 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' ); 396 396 } 397 397 … … 405 405 global $members_template, $bp; 406 406 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' ); 410 410 } 411 411 … … 419 419 global $members_template, $bp; 420 420 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' ); 424 424 } 425 425 … … 442 442 443 443 if ( empty( $user_id ) ) 444 $user_id = $bp->loggedin_user->id;444 $user_id = bp_loggedin_user_id(); 445 445 446 446 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 113 113 114 114 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 ); 116 116 117 117 do_action( 'groups_create_group_step_save_' . $bp->groups->current_create_step ); … … 139 139 // Once we compelete all steps, record the group creation in the activity stream. 140 140 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>' ) ), 142 142 'type' => 'created_group', 143 143 'item_id' => $bp->groups->new_group_id … … 208 208 209 209 // 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 ) ) { 211 211 212 212 // User wants to join a group that is not public 213 213 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 ) ) { 215 215 bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' ); 216 216 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); … … 243 243 244 244 // 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 ) ) { 246 246 247 247 // Stop sole admins from abandoning their group 248 248 $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() ) 250 250 bp_core_add_message( __( 'This group must have at least one admin', 'buddypress' ), 'error' ); 251 251 … … 308 308 309 309 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 ) ) 311 311 return false; 312 312 } -
trunk/bp-groups/bp-groups-activity.php
r4961 r5302 42 42 $defaults = array ( 43 43 'id' => false, 44 'user_id' => $bp->loggedin_user->id,44 'user_id' => bp_loggedin_user_id(), 45 45 'action' => '', 46 46 'content' => '', -
trunk/bp-groups/bp-groups-classes.php
r5301 r5302 42 42 $this->last_activity = $group->last_activity; 43 43 $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 ); 45 45 46 46 // Get group admins and mods … … 387 387 } 388 388 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() ) ) ) 390 390 $hidden_sql = " AND g.status != 'hidden'"; 391 391 … … 428 428 } 429 429 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() ) ) ) 431 431 $hidden_sql = " AND g.status != 'hidden'"; 432 432 … … 505 505 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 506 506 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() ) ) ) 508 508 $hidden_sql = "AND g.status != 'hidden'"; 509 509 … … 543 543 544 544 /* 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() ) ); 546 546 for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) { 547 547 $paged_groups[$i]->is_member = false; … … 553 553 } 554 554 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() ) ); 556 556 for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) { 557 557 $paged_groups[$i]->is_banned = false; … … 854 854 855 855 // 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() ) { 857 857 $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 ); 858 858 $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 ) ); … … 880 880 } 881 881 882 if ( $user_id != $bp->loggedin_user->id)882 if ( $user_id != bp_loggedin_user_id() ) 883 883 $hidden_sql = " AND g.status != 'hidden'"; 884 884 … … 902 902 } 903 903 904 if ( $user_id != $bp->loggedin_user->id)904 if ( $user_id != bp_loggedin_user_id() ) 905 905 $hidden_sql = " AND g.status != 'hidden'"; 906 906 … … 924 924 } 925 925 926 if ( $user_id != $bp->loggedin_user->id)926 if ( $user_id != bp_loggedin_user_id() ) 927 927 $hidden_sql = " AND g.status != 'hidden'"; 928 928 … … 939 939 $user_id = bp_displayed_user_id(); 940 940 941 if ( $user_id != $bp->loggedin_user->id&& !is_super_admin() ) {941 if ( $user_id != bp_loggedin_user_id() && !is_super_admin() ) { 942 942 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 ) ); 943 943 } else { … … 1126 1126 1127 1127 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() ) ); 1129 1129 for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) { 1130 1130 foreach ( (array)$friend_status as $status ) { -
trunk/bp-groups/bp-groups-forums.php
r5192 r5302 69 69 $topic = bp_forums_get_topic_details( $topic_id ); 70 70 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>' ); 72 72 $activity_content = bp_create_excerpt( $post_text ); 73 73 $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/'; … … 108 108 $topic = bp_forums_get_topic_details( $topic_id ); 109 109 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>' ); 111 111 $activity_content = bp_create_excerpt( $topic_text ); 112 112 -
trunk/bp-groups/bp-groups-functions.php
r5301 r5302 63 63 $group->creator_id = $creator_id; 64 64 else 65 $group->creator_id = $bp->loggedin_user->id;65 $group->creator_id = bp_loggedin_user_id(); 66 66 67 67 if ( isset( $name ) ) … … 248 248 249 249 if ( !$user_id ) 250 $user_id = $bp->loggedin_user->id;250 $user_id = bp_loggedin_user_id(); 251 251 252 252 // Don't let single admins leave the group. … … 289 289 290 290 if ( !$user_id ) 291 $user_id = $bp->loggedin_user->id;291 $user_id = bp_loggedin_user_id(); 292 292 293 293 // Check if the user has an outstanding invite, is so delete it. … … 407 407 408 408 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(); 410 410 411 411 if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) { … … 491 491 $defaults = array( 492 492 'content' => false, 493 'user_id' => $bp->loggedin_user->id,493 'user_id' => bp_loggedin_user_id(), 494 494 'group_id' => 0 495 495 ); … … 534 534 535 535 if ( !$user_id ) 536 $user_id = $bp->loggedin_user->id;536 $user_id = bp_loggedin_user_id(); 537 537 538 538 return BP_Groups_Member::get_invites( $user_id, $limit, $page, $exclude ); … … 545 545 'user_id' => false, 546 546 'group_id' => false, 547 'inviter_id' => $bp->loggedin_user->id,547 'inviter_id' => bp_loggedin_user_id(), 548 548 'date_modified' => bp_core_current_time(), 549 549 'is_confirmed' => 0 … … 634 634 635 635 if ( !$user_id ) 636 $user_id = $bp->loggedin_user->id;636 $user_id = bp_loggedin_user_id(); 637 637 638 638 // Send friend invites. -
trunk/bp-groups/bp-groups-loader.php
r5301 r5302 107 107 bp_update_is_item_admin( true, 'groups' ); 108 108 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' ); 110 110 111 111 // If the user is not an admin, check if they are a moderator 112 112 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' ); 114 114 115 115 // 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 ) ) ) 117 117 $this->current_group->is_user_member = true; 118 118 else … … 314 314 !is_super_admin() && 315 315 !$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 ) && 317 317 $this->current_group->status == 'private' 318 318 ) { … … 393 393 394 394 // 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() ); 396 396 397 397 if ( !empty( $count->total ) ) { -
trunk/bp-groups/bp-groups-screens.php
r5301 r5302 27 27 // Delete group request notifications for the user 28 28 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' ); 33 33 } 34 34 … … 89 89 if ( bp_is_single_item() ) { 90 90 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' ); 95 95 } 96 96 … … 130 130 $user_is_banned = false; 131 131 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 ) ) 133 133 $user_is_banned = true; 134 134 … … 141 141 142 142 // 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() ); 145 145 146 146 $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false; … … 219 219 220 220 /* 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 ) 222 222 bp_core_redirect( wp_get_referer() ); 223 223 … … 242 242 243 243 // 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 ) 245 245 bp_core_redirect( wp_get_referer() ); 246 246 … … 269 269 270 270 // 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 ) 272 272 bp_core_redirect( wp_get_referer() ); 273 273 … … 292 292 293 293 // 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 ) 295 295 bp_core_redirect( wp_get_referer() ); 296 296 … … 338 338 $error_message = __( "You have been banned from this group.", 'buddypress' ); 339 339 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 ) ) { 341 341 // 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() ); 343 343 } 344 344 … … 402 402 403 403 // 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 ); 405 405 bp_core_add_message( __('Group invites sent.', 'buddypress') ); 406 406 do_action( 'groups_screen_group_invite', $bp->groups->current_group->id ); … … 430 430 return false; 431 431 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 ) ) { 433 433 bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' ); 434 434 } else { -
trunk/bp-groups/bp-groups-template.php
r5301 r5302 111 111 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 112 112 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() ) ) 114 114 $show_hidden = true; 115 115 … … 309 309 return true; 310 310 } 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 ) ) { 312 312 return true; 313 313 } … … 1394 1394 1395 1395 if ( !$user_id ) 1396 $user_id = $bp->loggedin_user->id;1396 $user_id = bp_loggedin_user_id(); 1397 1397 1398 1398 return apply_filters( 'bp_group_is_user_banned', groups_is_user_banned( $user_id, $group->id ) ); … … 1468 1468 $group =& $groups_template->group; 1469 1469 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 ) ) 1471 1471 return false; 1472 1472 … … 1524 1524 // Stop sole admins from abandoning their group 1525 1525 $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() ) 1527 1527 return false; 1528 1528 … … 2228 2228 $group_id = !empty( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : $bp->groups->current_group->id; 2229 2229 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 ); 2232 2232 2233 2233 for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) { … … 2640 2640 $defaults = array( 2641 2641 'group_id' => false, 2642 'user_id' => $bp->loggedin_user->id2642 'user_id' => bp_loggedin_user_id() 2643 2643 ); 2644 2644 -
trunk/bp-members/bp-members-adminbar.php
r5301 r5302 30 30 // User avatar 31 31 $avatar = bp_core_fetch_avatar( array( 32 'item_id' => $bp->loggedin_user->id,32 'item_id' => bp_loggedin_user_id(), 33 33 'email' => $bp->loggedin_user->userdata->user_email, 34 34 'width' => 16, -
trunk/bp-members/bp-members-buddybar.php
r5301 r5302 13 13 _e( 'Notifications', 'buddypress' ); 14 14 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() ) ) { ?> 16 16 <span><?php echo count( $notifications ) ?></span> 17 17 <?php -
trunk/bp-members/bp-members-functions.php
r5301 r5302 214 214 215 215 // 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 ) { 217 217 $userdata = &$bp->loggedin_user->userdata; 218 218 … … 286 286 287 287 // 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 ) { 289 289 $userdata = &$bp->loggedin_user->userdata; 290 290 … … 594 594 595 595 if ( !$user_id ) 596 $user_id = $bp->loggedin_user->id;596 $user_id = bp_loggedin_user_id(); 597 597 598 598 // Make sure account deletion is not disabled -
trunk/bp-members/bp-members-loader.php
r5301 r5302 76 76 77 77 // 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() ); 79 79 80 80 // Hits the DB on single WP installs so get this separately … … 82 82 83 83 // 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() ); 85 85 86 86 // 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() ); 88 88 89 89 /** Displayed user ****************************************************/ -
trunk/bp-members/bp-members-notifications.php
r4961 r5302 36 36 37 37 function 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 ) ) 39 39 return false; 40 40 -
trunk/bp-members/bp-members-template.php
r5301 r5302 467 467 function bp_member_is_loggedin_user() { 468 468 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 ); 470 470 } 471 471 … … 721 721 if ( bp_is_active( 'friends' ) ) { 722 722 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() ) ) 724 724 $selected = ' class="current selected"'; 725 725 } … … 784 784 extract( $r, EXTR_SKIP ); 785 785 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 ) ) ); 787 787 } 788 788 … … 881 881 return apply_filters( 'bp_displayed_user_id', $id ); 882 882 } 883 function bp_current_user_id() { return bp_displayed_user_id(); }884 883 885 884 function bp_loggedin_user_id() { … … 894 893 return apply_filters( 'bp_loggedin_user_id', $id ); 895 894 } 895 896 function bp_current_user_id() { return bp_loggedin_user_id(); } 896 897 897 898 function bp_displayed_user_domain() { … … 944 945 global $bp; 945 946 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 ); 948 949 } else { 949 950 $username = ''; -
trunk/bp-messages/bp-messages-classes.php
r4961 r5302 39 39 40 40 // 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; 43 43 } 44 44 … … 67 67 global $wpdb, $bp; 68 68 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() ) ); 70 70 71 71 // Check to see if any more recipients remain for this message … … 123 123 global $wpdb, $bp; 124 124 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 ); 126 126 $wpdb->query($sql); 127 127 } … … 130 130 global $wpdb, $bp; 131 131 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 ); 133 133 $wpdb->query($sql); 134 134 } … … 157 157 return false; 158 158 159 return in_array( $bp->loggedin_user->id, $sender_ids );159 return in_array( bp_loggedin_user_id(), $sender_ids ); 160 160 } 161 161 … … 173 173 174 174 if ( empty( $user_id ) ) 175 $user_id = $bp->loggedin_user->id;175 $user_id = bp_loggedin_user_id(); 176 176 177 177 $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 ); … … 188 188 189 189 if ( empty( $user_id ) ) 190 $user_id = $bp->loggedin_user->id;190 $user_id = bp_loggedin_user_id(); 191 191 192 192 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 ) ); … … 259 259 260 260 $this->date_sent = bp_core_current_time(); 261 $this->sender_id = $bp->loggedin_user->id;261 $this->sender_id = bp_loggedin_user_id(); 262 262 263 263 if ( !empty( $id ) ) … … 355 355 global $wpdb, $bp; 356 356 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 ) ); 358 358 } 359 359 … … 422 422 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) ); 423 423 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() ); 425 425 426 426 do_action_ref_array( 'messages_notice_after_save', array( &$this ) ); -
trunk/bp-messages/bp-messages-functions.php
r4961 r5302 14 14 15 15 $defaults = array ( 16 'sender_id' => $bp->loggedin_user->id,16 'sender_id' => bp_loggedin_user_id(), 17 17 'thread_id' => false, // false for a new message, thread id for a reply to a thread. 18 18 'recipients' => false, // Can be an array of usernames, user_ids or mixed. … … 168 168 169 169 if ( empty( $user_id ) ) 170 $user_id = $bp->loggedin_user->id;170 $user_id = bp_loggedin_user_id(); 171 171 172 172 return BP_Messages_Thread::check_access( $thread_id, $user_id ); … … 197 197 198 198 if ( empty( $user_id ) ) 199 $user_id = $bp->loggedin_user->id;199 $user_id = bp_loggedin_user_id(); 200 200 201 201 return BP_Messages_Thread::get_inbox_count( $user_id ); -
trunk/bp-messages/bp-messages-template.php
r5301 r5302 128 128 if ( 'inbox' == $this->box ) { 129 129 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 ) { 131 131 $last_message_index = $key; 132 132 break; … … 136 136 } elseif ( 'sentbox' == $this->box ) { 137 137 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 ) { 139 139 $last_message_index = $key; 140 140 break; … … 160 160 161 161 $defaults = array( 162 'user_id' => $bp->loggedin_user->id,162 'user_id' => bp_loggedin_user_id(), 163 163 'box' => 'inbox', 164 164 'per_page' => 10, … … 174 174 } else { 175 175 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' ); 177 177 178 178 if ( 'sentbox' == $bp->current_action ) … … 781 781 782 782 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() ) 784 784 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); 785 785 } -
trunk/bp-themes/bp-default/_inc/ajax.php
r5301 r5302 40 40 if ( !empty( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) { 41 41 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(); 43 43 $qs[] = 'user_id=' . $user_id; 44 44 } … … 126 126 case 'mentions': 127 127 $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() ); 129 129 break; 130 130 default: … … 298 298 299 299 /* 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() ) 301 301 return false; 302 302 … … 424 424 return false; 425 425 426 if ( !friends_check_friendship( $bp->loggedin_user->id, $_POST['friend_id'] ) )426 if ( !friends_check_friendship( bp_loggedin_user_id(), $_POST['friend_id'] ) ) 427 427 return false; 428 428 … … 460 460 global $bp; 461 461 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'] ) ) { 463 463 464 464 check_ajax_referer('friends_remove_friend'); 465 465 466 if ( !friends_remove_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {466 if ( !friends_remove_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) { 467 467 echo __("Friendship could not be canceled.", 'buddypress'); 468 468 } else { … … 470 470 } 471 471 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'] ) ) { 473 473 474 474 check_ajax_referer('friends_add_friend'); 475 475 476 if ( !friends_add_friend( $bp->loggedin_user->id, $_POST['fid'] ) ) {476 if ( !friends_add_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) { 477 477 echo __("Friendship could not be requested.", 'buddypress'); 478 478 } else { … … 513 513 global $bp; 514 514 515 if ( groups_is_user_banned( $bp->loggedin_user->id, $_POST['gid'] ) )515 if ( groups_is_user_banned( bp_loggedin_user_id(), $_POST['gid'] ) ) 516 516 return false; 517 517 … … 519 519 return false; 520 520 521 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) {521 if ( !groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) { 522 522 523 523 if ( 'public' == $group->status ) { … … 535 535 check_ajax_referer( 'groups_request_membership' ); 536 536 537 if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {537 if ( !groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { 538 538 _e( 'Error requesting membership', 'buddypress' ); 539 539 } else { … … 688 688 $user_ids = array(); 689 689 foreach( $users['users'] as $user ) { 690 if ( $user->id != $bp->loggedin_user->id)690 if ( $user->id != bp_loggedin_user_id() ) 691 691 $user_ids[] = $user->id; 692 692 } … … 696 696 } else { 697 697 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 ); 699 699 700 700 // Keeping the bp_friends_autocomplete_list filter for backward compatibility -
trunk/bp-xprofile/bp-xprofile-activity.php
r5301 r5302 43 43 44 44 $defaults = array ( 45 'user_id' => $bp->loggedin_user->id,45 'user_id' => bp_loggedin_user_id(), 46 46 'action' => '', 47 47 'content' => '', -
trunk/bp-xprofile/bp-xprofile-cache.php
r4961 r5302 17 17 function xprofile_clear_profile_data_object_cache( $group_id ) { 18 18 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' ); 20 20 } 21 21 -
trunk/bp-xprofile/bp-xprofile-functions.php
r5301 r5302 392 392 393 393 if ( empty( $user_id ) ) 394 $user_id = $bp->loggedin_user->id;394 $user_id = bp_loggedin_user_id(); 395 395 396 396 if ( empty( $user_id ) )
Note: See TracChangeset
for help on using the changeset viewer.