[wpmu-trac] [WordPress MU Trac] #1072: 'restore_current_blog()' not returning to previous blog after multiple 'switch_to_blog()' function calls
WordPress MU Trac
wpmu-trac at lists.automattic.com
Wed Jul 22 21:54:00 UTC 2009
#1072: 'restore_current_blog()' not returning to previous blog after multiple
'switch_to_blog()' function calls
---------------------------------------------------+------------------------
Reporter: bigdawggi | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: component1 | Version: 2.8.2
Severity: normal | Resolution:
Keywords: switch to blog, restore current blog, |
---------------------------------------------------+------------------------
Comment (by bigdawggi):
Uploaded a new patch to address the following:
=== Issue ===
If you switch to the current blog id, while in a nested switch_to_blog,
the restore_current_blog() calls, don't match up, and give an incorrect
blog id at the end.
=== Resolution ===
- switch_to_blog() function:
- If you're switching to the same blog id, set the right vars to show
that you've switched, do any attached switch_to_blog actions, but return
before doing the heavy-lifting in the function (being that that has
already been done for this blog, by the previous switch)
- restore_current_blog() function:
- Removed the check for the same blog id, so that whenever the
restore_current_blog function is called, it always pops an item off the
$switched_stack array.
--
Ticket URL: <http://trac.mu.wordpress.org/ticket/1072#comment:1>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser
More information about the wpmu-trac
mailing list