Changeset 1238
- Timestamp:
- 03/19/2009 01:35:32 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-templatetags.php
r1193 r1238 33 33 34 34 $this->activity_count = count($this->activities); 35 36 35 $this->full_name = $bp->displayed_user->fullname; 37 36 -
trunk/bp-activity/bp-activity-widgets.php
r1052 r1238 28 28 } 29 29 ?> 30 31 <?php 32 if ( !$activity = wp_cache_get( 'sitewide_activity', 'bp' ) ) { 33 $activity = bp_activity_get_sitewide_activity( $options['max_items'] ); 34 wp_cache_set( 'sitewide_activity', $activity, 'bp' ); 35 } 36 ?> 30 37 31 <?php $activity = bp_activity_get_sitewide_activity( $options['max_items'] )?>38 <?php ?> 32 39 33 40 <?php if ( $activity ) : ?> -
trunk/bp-blogs.php
r1227 r1238 466 466 bp_blogs_record_post( $post_id ); 467 467 } 468 469 $recorded_post = $existing_post; 468 470 } 469 471 … … 623 625 bp_blogs_delete_activity( array( 'item_id' => $post->blog_id, 'secondary_item_id' => $post->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'user_id' => $post->user_id ) ); 624 626 625 do_action( 'bp_blogs_remove_post', $blog_id, $post_id );627 do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id ); 626 628 } 627 629 add_action( 'delete_post', 'bp_blogs_remove_post' ); … … 643 645 bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $comment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $bp->loggedin_user->id ) ); 644 646 645 do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id );647 do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id ); 646 648 } 647 649 add_action( 'delete_comment', 'bp_blogs_remove_comment' ); … … 834 836 add_action( 'wpmu_delete_user', 'bp_blogs_remove_data', 1 ); 835 837 add_action( 'delete_user', 'bp_blogs_remove_data', 1 ); 838 839 840 function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) { 841 wp_cache_delete( 'bp_user_blogs_' . $user_id, 'bp' ); 842 } 843 844 function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) { 845 bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id ); 846 } 847 848 function bp_blogs_clear_post_object_cache( $blog_id, $post_id, $user_id ) { 849 wp_cache_delete( 'bp_user_posts_' . $user_id, 'bp' ); 850 } 851 852 function bp_blogs_format_clear_post_cache( $recorded_post_obj ) { 853 bp_blogs_clear_post_object_cache( false, false, $recorded_post_obj->user_id ); 854 } 855 856 function bp_blogs_clear_comment_object_cache( $blog_id, $comment_id, $user_id ) { 857 wp_cache_delete( 'bp_user_comments_' . $user_id, 'bp' ); 858 } 859 860 function bp_blogs_format_clear_comment_cache( $recorded_comment_obj ) { 861 bp_blogs_clear_comment_object_cache( false, false, $recorded_comment_obj->user_id ); 862 } 863 864 // List actions to clear object caches on 865 add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 ); 866 add_action( 'bp_blogs_remove_post', 'bp_blogs_clear_post_object_cache', 10, 3 ); 867 add_action( 'bp_blogs_remove_comment', 'bp_blogs_clear_comment_object_cache', 10, 3 ); 868 869 add_action( 'bp_blogs_new_blog', 'bp_blogs_format_clear_blog_cache', 10, 2 ); 870 add_action( 'bp_blogs_new_blog_post', 'bp_blogs_format_clear_post_cache', 10, 2 ); 871 add_action( 'bp_blogs_new_blog_comment', 'bp_blogs_format_clear_comment_cache', 10, 2 ); 836 872 837 873 // List actions to clear super cached pages on, if super cache is installed … … 844 880 add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' ); 845 881 add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' ); 846 add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' );847 882 add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' ); 848 883 -
trunk/bp-blogs/bp-blogs-classes.php
r1052 r1238 365 365 $total_post_count = $wpdb->get_var( $wpdb->prepare( "SELECT count(p.post_id) FROM {$bp->blogs->table_name_blog_posts} p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.deleted = 0 AND b.archived = '0' AND b.spam = 0 AND b.mature = 0 AND p.user_id = %d", $user_id) ); 366 366 } 367 368 367 369 368 for ( $i = 0; $i < count($post_ids); $i++ ) { 370 369 $posts[$i] = BP_Blogs_Post::fetch_post_content($post_ids[$i]); -
trunk/bp-blogs/bp-blogs-templatetags.php
r1052 r1238 25 25 26 26 $this->blogs = bp_blogs_get_blogs_for_user( $user_id ); 27 28 if ( !$this->blogs = wp_cache_get( 'bp_user_blogs_' . $user_id, 'bp' ) ) { 29 $this->blogs = bp_blogs_get_blogs_for_user( $user_id ); 30 wp_cache_set( 'bp_user_blogs_' . $user_id, $this->blogs, 'bp' ); 31 } 32 27 33 $this->total_blog_count = (int)$this->blogs['count']; 28 34 $this->blogs = $this->blogs['blogs']; … … 141 147 $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1; 142 148 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 5; 143 144 $this->posts = bp_blogs_get_posts_for_user( $user_id ); 149 150 if ( !$this->posts = wp_cache_get( 'bp_user_posts_' . $user_id, 'bp' ) ) { 151 $this->posts = bp_blogs_get_posts_for_user( $user_id ); 152 wp_cache_set( 'bp_user_posts_' . $user_id, $this->posts, 'bp' ); 153 } 154 145 155 $this->total_post_count = (int)$this->posts['count']; 146 156 $this->posts = $this->posts['posts']; … … 489 499 $this->pag_page = isset( $_GET['fpage'] ) ? intval( $_GET['fpage'] ) : 1; 490 500 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 5; 491 492 $this->comments = bp_blogs_get_comments_for_user( $user_id ); 501 502 if ( !$this->comments = wp_cache_get( 'bp_user_comments_' . $user_id, 'bp' ) ) { 503 $this->comments = bp_blogs_get_comments_for_user( $user_id ); 504 wp_cache_set( 'bp_user_comments_' . $user_id, $this->comments, 'bp' ); 505 } 506 493 507 $this->total_comment_count = (int)$this->comments['count']; 494 508 $this->comments = $this->comments['comments']; -
trunk/bp-core.php
r1236 r1238 1341 1341 1342 1342 function bp_core_print_generation_time() { 1343 global $wpdb; 1343 1344 ?> 1344 1345 <!-- Generated in <?php timer_stop(1); ?> seconds. --> … … 1360 1361 /* Remove usermeta */ 1361 1362 delete_usermeta( $user_id, 'last_activity' ); 1363 wp_cache_flush(); 1362 1364 } 1363 1365 add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 ); 1364 1366 add_action( 'delete_user', 'bp_core_remove_data', 1 ); 1367 1368 function bp_core_clear_user_object_cache( $user_id ) { 1369 wp_cache_delete( 'bp_user_' . $user_id, 'bp' ); 1370 wp_cache_delete( 'online_users' ); 1371 wp_cache_delete( 'newest_users' ); 1372 } 1373 1374 // List actions to clear object caches on 1375 add_action( 'bp_core_delete_avatar', 'bp_core_clear_user_object_cache' ); 1376 add_action( 'bp_core_avatar_save', 'bp_core_clear_user_object_cache' ); 1365 1377 1366 1378 // List actions to clear super cached pages on, if super cache is installed -
trunk/bp-core/bp-core-adminbar.php
r1209 r1238 126 126 127 127 if ( function_exists('bp_blogs_install') ) { 128 $blogs = get_blogs_of_user( $bp->loggedin_user->id ); // find *all* blogs with any kind of role 128 129 if ( !$blogs = wp_cache_get( 'bp_user_blogs_' . $bp->loggedin_user->id, 'bp' ) ) { 130 $blogs = get_blogs_of_user( $bp->loggedin_user->id ); 131 wp_cache_set( 'bp_user_blogs_' . $bp->loggedin_user->id, $blogs, 'bp' ); 132 } 129 133 130 134 echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">'; -
trunk/bp-core/bp-core-ajax.php
r1197 r1238 8 8 switch ( $_POST['filter'] ) { 9 9 case 'newest-members': 10 $users = BP_Core_User::get_newest_users( $_POST['max-members'], 1 ); 10 if ( !$users = wp_cache_get( 'newest_users', 'bp' ) ) { 11 $users = BP_Core_User::get_newest_users( $_POST['max-members'], 1 ); 12 wp_cache_set( 'newest_users', $users, 'bp' ); 13 } 11 14 break; 12 15 case 'recently-active-members': 13 $users = BP_Core_User::get_active_users( $_POST['max-members'], 1 ); 16 if ( !$users = wp_cache_get( 'active_users', 'bp' ) ) { 17 $users = BP_Core_User::get_active_users( $_POST['max-members'], 1 ); 18 wp_cache_set( 'active_users', $users, 'bp' ); 19 } 14 20 break; 15 21 case 'popular-members': 16 $users = BP_Core_User::get_popular_users( $_POST['max-members'], 1 ); 22 if ( !$users = wp_cache_get( 'popular_users', 'bp' ) ) { 23 $users = BP_Core_User::get_popular_users( $_POST['max-members'], 1 ); 24 wp_cache_set( 'popular_users', $users, 'bp' ); 25 } 17 26 break; 18 27 } … … 117 126 118 127 <div class="action"> 119 <?php bp_add_friend_button( $user->user_id ) ?> 128 <?php if ( function_exists('bp_add_friend_button') ) : ?> 129 <?php bp_add_friend_button( $user->user_id ) ?> 130 <?php endif; ?> 120 131 <div class="meta"> 121 132 <?php if ( $user_obj->total_friends ) echo $user_obj->total_friends ?><?php if ( $user_obj->total_blogs ) echo ', ' . $user_obj->total_blogs ?><?php if ( $user_obj->total_groups ) echo ', ' . $user_obj->total_groups ?> -
trunk/bp-core/bp-core-avatars.php
r1209 r1238 435 435 } 436 436 437 do_action( 'bp_core_avatar_save', $ old, $v1_href, $vars['v1_out'] );437 do_action( 'bp_core_avatar_save', $user_id, $old, $v1_href, $vars['v1_out'] ); 438 438 } 439 439 … … 458 458 459 459 function bp_core_delete_avatar() { 460 $old_v1 = get_usermeta( get_current_user_id(), 'bp_core_avatar_v1_path' ); 461 $old_v2 = get_usermeta( get_current_user_id(), 'bp_core_avatar_v2_path' ); 462 463 delete_usermeta( get_current_user_id(), 'bp_core_avatar_v1_path' ); 464 delete_usermeta( get_current_user_id(), 'bp_core_avatar_v2_path' ); 465 466 delete_usermeta( get_current_user_id(), 'bp_core_avatar_v1' ); 467 delete_usermeta( get_current_user_id(), 'bp_core_avatar_v2' ); 460 $user_id = get_current_user_id(); 461 462 $old_v1 = get_usermeta( $user_id, 'bp_core_avatar_v1_path' ); 463 $old_v2 = get_usermeta( $user_id, 'bp_core_avatar_v2_path' ); 464 465 delete_usermeta( $user_id, 'bp_core_avatar_v1_path' ); 466 delete_usermeta( $user_id, 'bp_core_avatar_v2_path' ); 467 468 delete_usermeta( $user_id, 'bp_core_avatar_v1' ); 469 delete_usermeta( $user_id, 'bp_core_avatar_v2' ); 468 470 469 471 // Remove the actual images … … 471 473 @unlink($old_v2); 472 474 473 do_action( 'bp_core_delete_avatar', $ old_v1, $old_v2 );475 do_action( 'bp_core_delete_avatar', $user_id, $old_v1, $old_v2 ); 474 476 } 475 477 -
trunk/bp-core/bp-core-templatetags.php
r1232 r1238 232 232 function bp_fetch_user_fullname( $user_id = false, $echo = true ) { 233 233 global $bp; 234 234 235 235 if ( !$user_id ) 236 236 $user_id = $bp->displayed_user->id; 237 238 if ( function_exists('xprofile_install') ) { 239 $data = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ); 240 241 if ( empty($data) ) { 237 238 if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) { 239 if ( function_exists('xprofile_install') ) { 240 $fullname = bp_core_ucfirst( xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ) ); 241 242 if ( empty($fullname) ) { 243 $ud = get_userdata($user_id); 244 $fullname = bp_core_ucfirst($ud->user_login); 245 246 xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $data ); 247 } 248 } else { 242 249 $ud = get_userdata($user_id); 243 $data = bp_core_ucfirst($ud->user_login); 244 245 xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $data ); 246 } else { 247 $data = bp_core_ucfirst($data); 250 $fullname = $ud->user_login; 248 251 } 249 } else { 250 $ud = get_userdata($user_id); 251 $data = $ud->user_login; 252 253 wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' ); 252 254 } 253 255 254 256 if ( $echo ) 255 echo apply_filters( 'bp_fetch_user_fullname', stripslashes( trim( $ data) ) );257 echo apply_filters( 'bp_fetch_user_fullname', stripslashes( trim( $fullname ) ) ); 256 258 else 257 return apply_filters( 'bp_fetch_user_fullname', stripslashes ( trim ( $ data) ) );259 return apply_filters( 'bp_fetch_user_fullname', stripslashes ( trim ( $fullname ) ) ); 258 260 } 259 261 -
trunk/bp-core/bp-core-widgets.php
r1209 r1238 90 90 . $after_title; ?> 91 91 92 <?php $users = BP_Core_User::get_newest_users( $options['max_members'] ) ?> 92 <?php 93 if ( !$users = wp_cache_get( 'newest_users', 'bp' ) ) { 94 $users = BP_Core_User::get_newest_users( $options['max_members'] ); 95 wp_cache_set( 'newest_users', $users, 'bp' ); 96 } 97 ?> 93 98 94 99 <?php if ( $users['users'] ) : ?> … … 120 125 ?> 121 126 122 <input type="hidden" name=" bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php echo $options['max_members'] ?>" />127 <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo $options['max_members'] ?>" /> 123 128 124 129 <?php else: ?> … … 165 170 . $widget_name 166 171 . $after_title; ?> 172 173 <?php 174 if ( !$users = wp_cache_get( 'online_users', 'bp' ) ) { 175 $users = BP_Core_User::get_online_users( $options['max_members'] ); 176 wp_cache_set( 'online_users', $users, 'bp' ); 177 } 178 ?> 167 179 168 180 <?php $users = BP_Core_User::get_online_users($options['max_members']) ?> -
trunk/bp-core/js/widget-members.js
r1052 r1238 11 11 'cookie': encodeURIComponent(document.cookie), 12 12 '_wpnonce': jQuery("input#_wpnonce-members").val(), 13 'max-members': jQuery("input# bp_core_widget_members_max").val(),13 'max-members': jQuery("input#members_widget_max").val(), 14 14 'filter': jQuery(this).attr('id') 15 15 }, -
trunk/bp-friends.php
r1227 r1238 619 619 add_action( 'delete_user', 'friends_remove_data', 1 ); 620 620 621 function friends_clear_friend_object_cache( $friendship_id ) { 622 if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) ) 623 return false; 624 625 wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' ); 626 wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' ); 627 wp_cache_delete( 'popular_users', 'bp' ); 628 } 629 630 // List actions to clear object caches on 631 add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' ); 632 add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' ); 633 621 634 // List actions to clear super cached pages on, if super cache is installed 622 635 add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' ); -
trunk/bp-friends/bp-friends-templatetags.php
r1205 r1238 106 106 } else { 107 107 $this->friendship = (object) $this->friendship; 108 $this->friendship->friend = new BP_Core_User( $this->friendship->user_id ); 108 109 if ( !$this->friendship->friend = wp_cache_get( 'bp_user_' . $this->friendship->user_id, 'bp' ) ) { 110 $this->friendship->friend = new BP_Core_User( $this->friendship->user_id ); 111 wp_cache_set( 'bp_user_' . $this->friendship->user_id, $this->friendship->friend, 'bp' ); 112 } 109 113 } 110 114 … … 339 343 global $bp; 340 344 341 $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id ); 345 if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . $bp->displayed_user->id, 'bp' ) ) { 346 $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id ); 347 wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' ); 348 } 342 349 ?> 343 350 <div class="info-group"> … … 366 373 global $bp; 367 374 368 $user_ids = BP_Core_User::get_random_users( $total_members ); 375 if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) { 376 $user_ids = BP_Core_User::get_random_users( $total_members ); 377 wp_cache_set( 'friends_random_users', $user_ids, 'bp' ); 378 } 369 379 ?> 370 380 <?php if ( $user_ids['users'] ) { ?> -
trunk/bp-groups.php
r1227 r1238 706 706 } 707 707 708 do_action( 'groups_group_avatar_ edited', $group_obj->id );708 do_action( 'groups_group_avatar_updated', $group_obj->id ); 709 709 710 710 bp_core_redirect( site_url() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/group-avatar' ); … … 2313 2313 2314 2314 2315 function groups_clear_group_object_cache( $group_id ) { 2316 wp_cache_delete( 'groups_group_nouserdata_' . $group_id, 'bp' ); 2317 wp_cache_delete( 'groups_group_' . $group_id, 'bp' ); 2318 wp_cache_delete( 'newest_groups', 'bp' ); 2319 wp_cache_delete( 'active_groups', 'bp' ); 2320 wp_cache_delete( 'popular_groups', 'bp' ); 2321 wp_cache_delete( 'groups_random_groups', 'bp' ); 2322 } 2323 2324 // List actions to clear object caches on 2325 add_action( 'groups_group_deleted', 'groups_clear_group_object_cache' ); 2326 add_action( 'groups_settings_updated', 'groups_clear_group_object_cache' ); 2327 add_action( 'groups_details_updated', 'groups_clear_group_object_cache' ); 2328 add_action( 'groups_group_avatar_updated', 'groups_clear_group_object_cache' ); 2329 2315 2330 // List actions to clear super cached pages on, if super cache is installed 2316 2331 add_action( 'groups_new_wire_post', 'bp_core_clear_cache' ); -
trunk/bp-groups/bp-groups-ajax.php
r1221 r1238 59 59 switch ( $_POST['filter'] ) { 60 60 case 'newest-groups': 61 $groups = groups_get_newest( $_POST['max-groups'], 1 ); 61 if ( !$groups = wp_cache_get( 'newest_groups', 'bp' ) ) { 62 $groups = groups_get_newest( $_POST['max-groups'], 1 ); 63 wp_cache_set( 'newest_groups', $groups, 'bp' ); 64 } 62 65 break; 63 66 case 'recently-active-groups': 64 $groups = groups_get_active( $_POST['max-groups'], 1 ); 67 if ( !$groups = wp_cache_get( 'active_groups', 'bp' ) ) { 68 $groups = groups_get_active( $_POST['max-groups'], 1 ); 69 wp_cache_set( 'active_groups', $groups, 'bp' ); 70 } 65 71 break; 66 72 case 'popular-groups': 67 $groups = groups_get_popular( $_POST['max-groups'], 1 ); 73 if ( !$groups = wp_cache_get( 'popular_groups', 'bp' ) ) { 74 $groups = groups_get_popular( $_POST['max-groups'], 1 ); 75 wp_cache_set( 'popular_groups', $groups, 'bp' ); 76 } 68 77 break; 69 78 } … … 72 81 echo '0[[SPLIT]]'; // return valid result. 73 82 74 foreach ( (array) $groups['groups'] as $group ) { 75 $group = new BP_Groups_Group( $group->group_id, false, false ); 83 foreach ( (array) $groups['groups'] as $group_id ) { 84 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) { 85 $group = new BP_Groups_Group( $group_id->group_id, false, false ); 86 wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' ); 87 } 76 88 ?> 77 89 <li> … … 240 252 <?php $counter = 0; ?> 241 253 <ul id="groups-list" class="item-list"> 242 <?php foreach ( $groups['groups'] as $group ) : ?>254 <?php foreach ( $groups['groups'] as $group_id ) : ?> 243 255 244 256 <?php $alt = ( $counter % 2 == 1 ) ? ' class="alt"' : ''; ?> 245 <?php $group = new BP_Groups_Group( $group->group_id, false, false ); ?> 257 <?php 258 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) { 259 $group = new BP_Groups_Group( $group_id->group_id, false, false ); 260 wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' ); 261 } 262 ?> 246 263 247 264 <li<?php echo $alt ?>> -
trunk/bp-groups/bp-groups-templatetags.php
r1221 r1238 152 152 153 153 // If this is a single group then instantiate group meta when creating the object. 154 if ( $this->single_group ) 155 $this->group = new BP_Groups_Group( $this->group->group_id, true ); 156 else 157 $this->group = new BP_Groups_Group( $this->group->group_id, false, false ); 158 154 if ( $this->single_group ) { 155 if ( !$group = wp_cache_get( 'groups_group_' . $this->group->group_id, 'bp' ) ) { 156 $group = new BP_Groups_Group( $this->group->group_id, true ); 157 wp_cache_set( 'groups_group_' . $this->group->group_id, $group, 'bp' ); 158 } 159 } else { 160 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $this->group->group_id, 'bp' ) ) { 161 $group = new BP_Groups_Group( $this->group->group_id, false, false ); 162 wp_cache_set( 'groups_group_nouserdata_' . $this->group->group_id, $group, 'bp' ); 163 } 164 } 165 166 $this->group = $group; 167 159 168 if ( 0 == $this->current_group ) // loop has just started 160 169 do_action('loop_start'); … … 984 993 985 994 <ul id="friend-list" class="item-list"> 986 <?php for( $i = 0; $i < count($invites); $i++ ) { 987 $user = new BP_Core_User( $invites[$i] ); ?> 988 995 <?php for ( $i = 0; $i < count($invites); $i++ ) { 996 if ( !$user = wp_cache_get( 'bp_user_' . $invites[$i], 'bp' ) ) { 997 $user = new BP_Core_User( $invites[$i] ); 998 wp_cache_set( 'bp_user_' . $invites[$i], $user, 'bp' ); 999 } 1000 ?> 989 1001 <li id="uid-<?php echo $user->id ?>"> 990 1002 <?php echo $user->avatar_thumb ?> … … 1356 1368 global $bp; 1357 1369 1358 $group_ids = BP_Groups_Group::get_random( $total_groups, 1 ); 1370 if ( !$group_ids = wp_cache_get( 'groups_random_groups', 'bp' ) ) { 1371 $group_ids = BP_Groups_Group::get_random( $total_groups, 1 ); 1372 wp_cache_set( 'groups_random_groups', $group_ids, 'bp' ); 1373 } 1359 1374 ?> 1360 1375 <?php if ( $group_ids['groups'] ) { ?> 1361 1376 <ul class="item-list" id="random-groups-list"> 1362 <?php for ( $i = 0; $i < count( $group_ids['groups'] ); $i++ ) { ?> 1363 <?php $group = new BP_Groups_Group( $group_ids['groups'][$i]->group_id, false, false ); ?> 1377 <?php 1378 for ( $i = 0; $i < count( $group_ids['groups'] ); $i++ ) { 1379 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_ids['groups'][$i]->group_id, 'bp' ) ) { 1380 $group = new BP_Groups_Group( $group_ids['groups'][$i]->group_id, false, false ); 1381 wp_cache_set( 'groups_group_nouserdata_' . $group_ids['groups'][$i]->group_id, $group, 'bp' ); 1382 } 1383 ?> 1364 1384 <li> 1365 1385 <div class="item-avatar"> … … 1401 1421 global $bp; 1402 1422 1403 $group_ids = groups_get_random_groups_for_user( $bp->displayed_user->id, $total_groups, 1 ); 1423 if ( !$group_ids = wp_cache_get( 'groups_random_user_groups_' . $bp->displayed_user->id . '_' . $total_groups, 'bp' ) ) { 1424 $group_ids = groups_get_random_groups_for_user( $bp->displayed_user->id, $total_groups, 1 ); 1425 wp_cache_set( 'groups_random_user_groups_' . $bp->displayed_user->id . '_' . $total_groups, $group_ids, 'bp' ); 1426 } 1427 1404 1428 ?> 1405 1429 <div class="info-group"> … … 1407 1431 <?php if ( $group_ids ) { ?> 1408 1432 <ul class="horiz-gallery"> 1409 <?php for ( $i = 0; $i < count( $group_ids ); $i++ ) { ?> 1410 <?php $group = new BP_Groups_Group( $group_ids[$i], false, false ); ?> 1411 <li> 1433 <?php 1434 for ( $i = 0; $i < count( $group_ids ); $i++ ) { 1435 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_ids[$i], 'bp' ) ) { 1436 $group = new BP_Groups_Group( $group_ids[$i], false, false ); 1437 wp_cache_set( 'groups_group_nouserdata_' . $group_ids[$i], $group, 'bp' ); 1438 } 1439 ?> <li> 1412 1440 <a href="<?php echo bp_group_permalink( $group, false ) ?>"><img src="<?php echo $group->avatar_thumb; ?>" class="avatar" alt="<?php _e( 'Group Avatar', 'buddypress' ) ?>" /></a> 1413 1441 <h5><a href="<?php echo bp_group_permalink( $group, false ) ?>"><?php echo $group->name ?></a></h5> -
trunk/bp-groups/bp-groups-widgets.php
r1221 r1238 28 28 . $widget_name 29 29 . $after_title; ?> 30 31 <?php $groups = groups_get_popular( $options['max_groups'], 1 ); ?> 32 30 31 <?php 32 if ( !$groups = wp_cache_get( 'popular_groups', 'bp' ) ) { 33 $groups = groups_get_popular( $options['max_groups'], 1 ); 34 wp_cache_set( 'popular_groups', $groups, 'bp' ); 35 } 36 ?> 37 33 38 <?php if ( $groups['groups'] ) : ?> 34 39 <div class="item-options" id="groups-list-options"> … … 39 44 </div> 40 45 <ul id="groups-list" class="item-list"> 41 <?php foreach ( $groups['groups'] as $group ) : ?> 42 <?php $group = new BP_Groups_Group( $group->group_id, false, false ) ?> 46 <?php foreach ( $groups['groups'] as $group_id ) : ?> 47 <?php 48 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) { 49 $group = new BP_Groups_Group( $group_id->group_id, false, false ); 50 wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' ); 51 } 52 ?> 43 53 <li> 44 54 <div class="item-avatar"> … … 68 78 ?> 69 79 70 <input type="hidden" name="groups_widget_ groups_list_max_groups" id="groups_widget_groups_list_max_groups" value="<?php echo $options['max_groups'] ?>" />80 <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo $options['max_groups'] ?>" /> 71 81 72 82 <?php else: ?> -
trunk/bp-groups/directories/bp-groups-directory-groups.php
r1209 r1238 100 100 101 101 <ul id="groups-list" class="item-list"> 102 <?php foreach ( $groups['groups'] as $group ) : ?> 103 <?php $group = new BP_Groups_Group( $group->group_id, false, false ); ?> 102 <?php foreach ( $groups['groups'] as $group_id ) : ?> 103 <?php 104 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) { 105 $group = new BP_Groups_Group( $group_id->group_id, false, false ); 106 wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' ); 107 } 108 ?> 104 109 <li> 105 110 <div class="item-avatar"> … … 175 180 <?php if ( $groups['groups'] ) { ?> 176 181 <ul id="featured-group-list" class="item-list"> 177 <?php foreach( $groups['groups'] as $group ) : ?> 178 <?php $group = new BP_Groups_Group( $group->group_id, false, false ); ?> 182 <?php foreach( $groups['groups'] as $group_id ) : ?> 183 <?php 184 if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $group_id->group_id, 'bp' ) ) { 185 $group = new BP_Groups_Group( $group_id->group_id, false, false ); 186 wp_cache_set( 'groups_group_nouserdata_' . $group_id->group_id, $group, 'bp' ); 187 } 188 ?> 179 189 <li> 180 190 <div class="item-avatar"> -
trunk/bp-groups/js/widget-groups.js
r1052 r1238 11 11 'cookie': encodeURIComponent(document.cookie), 12 12 '_wpnonce': jQuery("input#_wpnonce-groups").val(), 13 'max-groups': jQuery("input#groups_widget_ groups_list_max_groups").val(),13 'max-groups': jQuery("input#groups_widget_max").val(), 14 14 'filter': jQuery(this).attr('id') 15 15 }, -
trunk/bp-wire/bp-wire-classes.php
r1052 r1238 95 95 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 96 96 97 $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE item_id = %d 97 $wire_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE item_id = %d ORDER BY date_posted DESC $pag_sql", $item_id ) ); 98 98 $count = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$table_name} WHERE item_id = %d", $item_id ) ); 99 99 -
trunk/bp-xprofile.php
r1230 r1238 622 622 * handling the save action. 623 623 * 624 * [NOTE] This is old code that was written when support for the admin area was also625 * available. It is big and clunky and needs to be broken up.624 * [NOTE] This is old code that was written when editing was not done in the theme. 625 * It is big and clunky and will be broken up in future versions. 626 626 * 627 627 * @package BuddyPress XProfile … … 965 965 add_action( 'delete_user', 'xprofile_remove_data', 1 ); 966 966 967 968 function xprofile_clear_profile_groups_object_cache( $group_obj ) { 969 wp_cache_delete( 'xprofile_groups', 'bp' ); 970 wp_cache_delete( 'xprofile_groups_inc_empty', 'bp' ); 971 wp_cache_delete( 'xprofile_group_' . $group_obj->id ); 972 } 973 974 function xprofile_clear_profile_data_object_cache( $group_id ) { 975 global $bp; 976 wp_cache_delete( 'xprofile_fields_' . $group_id . '_' . $bp->loggedin_user->id, 'bp' ); 977 wp_cache_delete( 'online_users', 'bp' ); 978 wp_cache_delete( 'newest_users', 'bp' ); 979 wp_cache_delete( 'popular_users', 'bp' ); 980 } 981 982 // List actions to clear object caches on 983 add_action( 'xprofile_groups_deleted_group', 'xprofile_clear_profile_groups_object_cache' ); 984 add_action( 'xprofile_groups_saved_group', 'xprofile_clear_profile_groups_object_cache' ); 985 add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache' ); 986 967 987 // List actions to clear super cached pages on, if super cache is installed 968 988 add_action( 'xprofile_updated_profile', 'bp_core_clear_cache' ); -
trunk/bp-xprofile/bp-xprofile-admin.php
r1141 r1238 154 154 $message = __('The group was saved successfully.', 'buddypress'); 155 155 $type = 'success'; 156 157 do_action( 'xprofile_groups_saved_group', $group ); 156 158 } 157 159 … … 184 186 $message = __('The group was deleted successfully.', 'buddypress'); 185 187 $type = 'success'; 188 189 do_action( 'xprofile_groups_deleted_group', $group ); 186 190 } 187 191 … … 224 228 unset($_GET['mode']); 225 229 226 $groups = $groups = BP_XProfile_Group::get_all(); 230 do_action( 'xprofile_fields_saved_field', $field ); 231 232 $groups = BP_XProfile_Group::get_all(); 227 233 xprofile_admin( $message, $type ); 228 234 } … … 258 264 $message = sprintf( __('The %s was deleted successfully!', 'buddypress'), $type); 259 265 $type = 'success'; 266 267 do_action( 'xprofile_fields_deleted_field', $field ); 260 268 } 261 269 -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r1224 r1238 17 17 18 18 function bp_xprofile_template($user_id) { 19 $this->groups = BP_XProfile_Group::get_all(true); 19 if ( !$this->groups = wp_cache_get( 'xprofile_groups', 'bp' ) ) { 20 $this->groups = BP_XProfile_Group::get_all(true); 21 wp_cache_set( 'xprofile_groups', $this->groups, 'bp' ); 22 } 23 20 24 $this->group_count = count($this->groups); 21 25 $this->user_id = $user_id; … … 35 39 $this->field_count = count($this->group->fields); 36 40 37 for ( $i = 0; $i < $this->field_count; $i++ ) { 38 $this->group->fields[$i] = new BP_XProfile_Field( $this->group->fields[$i]->id, $this->user_id ); 39 } 41 if ( !$fields = wp_cache_get( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, 'bp' ) ) { 42 for ( $i = 0; $i < $this->field_count; $i++ ) { 43 $field = new BP_XProfile_Field( $this->group->fields[$i]->id, $this->user_id ); 44 $fields[$i] = $field; 45 } 46 47 wp_cache_set( 'xprofile_fields_' . $this->group->id . '_' . $this->user_id, $fields, 'bp' ); 48 } 49 50 $this->group->fields = $fields; 40 51 41 52 return $this->group; … … 227 238 global $bp, $group_name; 228 239 229 $groups = BP_XProfile_Group::get_all(); 230 240 if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) { 241 $groups = BP_XProfile_Group::get_all(); 242 wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' ); 243 } 244 231 245 if ( empty( $group_name ) ) 232 246 $group_name = bp_profile_group_name(false); … … 253 267 $group_id = 1; 254 268 255 $group = new BP_XProfile_Group($group_id); 269 if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { 270 $group = new BP_XProfile_Group($group_id); 271 wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' ); 272 } 256 273 257 274 if ( $echo ) {
Note: See TracChangeset
for help on using the changeset viewer.