[wp-trac] [WordPress Trac] #21459: Cleanup switch_to_blog() and restore_current_blog()

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 6 14:14:46 UTC 2012


#21459: Cleanup switch_to_blog() and restore_current_blog()
-------------------------+-----------------------
 Reporter:  ryan         |       Owner:  ryan
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  3.5
Component:  Multisite    |     Version:  3.4.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------

Comment (by joostdekeijzer):

 The example code is running after init in my plugin.

 I've written a test-case but I must say I can't replicate the issue there.
 It is my first test-case ever so it's possible I'm doing something
 wrong...


 Looking into this I was wondering why the current_user_can_for_blog
 function was changed. The "original" didn't use the switch_to_blog()
 function anywhere but $WP_User->for_blog( $blog_id ) which is very fast.
 Written a speed-test-case for this :-)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21459#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list