[buddypress-trac] [BuddyPress Trac] #5921: Add post to blog button: Enhancement suggestion for bp-blogs/bp-blogs-template.php

buddypress-trac noreply at wordpress.org
Fri Oct 3 15:43:15 UTC 2014


#5921: Add post to blog button: Enhancement suggestion for bp-blogs/bp-blogs-
template.php
---------------------------------------------+-----------------------------
 Reporter:  lenasterg                        |       Owner:
     Type:  enhancement                      |      Status:  new
 Priority:  normal                           |   Milestone:  Awaiting
Component:  Blogs                            |  Review
 Severity:  normal                           |     Version:
 Keywords:  reporter-feedback needs-testing  |  Resolution:
---------------------------------------------+-----------------------------

Comment (by boonebgorges):

 Thanks, lenasterg! I hadn't thought of this specific way of caching the
 values, but at a glance it seems like it should work fairly well. It'll
 still require `switch_to_blog()` for the cap checks, but at least the cap
 checks will only happen when we know that the current user is a member of
 the blog.

 If it turns out that your technique doesn't perform well, we might try
 messing with WP's `get_blogs_of_user()`, which I believe gets role
 information in a single query.

 Here's a simple technique to test the query overhead:

 - Add `define( 'SAVEQUERIES', true );` to wp-config.php
 - Put the following function somewhere (wp-config.php is fine):

 {{{
 function debug_database_queries() {
     global $wpdb;
     echo '<pre>';
     print_r( $wpdb->queries );
     echo '</pre>';
 }
 register_shutdown_function( 'debug_database_queries' );
 }}}

 Run that before and after the patch. That'll give you a sense of how many
 queries are being introduced, and how that affects load time.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5921#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list