[buddypress-trac] [BuddyPress] #4908: Avoid switch_to_blog in bp_core_fetch_avatar
buddypress-trac
noreply at wordpress.org
Tue Apr 2 20:47:24 UTC 2013
#4908: Avoid switch_to_blog in bp_core_fetch_avatar
--------------------------+---------------------
Reporter: wpdennis | Owner:
Type: defect (bug) | Status: closed
Priority: high | Milestone: 1.7
Component: Core | Version: 1.7
Severity: normal | Resolution: fixed
Keywords: dev-feedback |
--------------------------+---------------------
Comment (by wpdennis):
Hey boone,
thank you. In combination with bbpress <2.3 there are a multiple of db
requests per avatar, because it hooks bbp_set_current_user_default() to
switch_to_blog(). I think it will change with 2.3 but I'm not sure here.
But besides that, even with object cache there will be still one
switch_to_blog() on each page view. Maybe you can consider to provide a
constant like BP_AVATAR_ENABLED for the wp-config.php, because it's a
really "constant" behaviour in each network.
Something like:
{{{
$bp->avatar->show_avatars = (defined('BP_AVATAR_ENABLED') &&
is_bool(BP_AVATAR_ENABLED)) ? BP_AVATAR_ENABLED : (bool) bp_get_option(
'show_avatars' );
}}}
I would love to have the opportunity to avoid any queries with
switch_to_blog(), especially for something that (nearly) never changes.
What do you think?
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4908#comment:3>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list