Yeah, I filled a Trac ticket to have someone look into this. Nothing looks different about the switch_to_blog function, so I assume the problem is elsewhere.
http://trac.mu.wordpress.org/ticket/684
Meanwhile, it's no help to my users, but I'll just have to add in the cookie I need for each blog I work on till it gets fixed, I guess. .
Can you paste the source code of your script at the end of the script please?
I tried the following, http://pastebin.com/m7bc5b666
It worked fine. It displayed:
wp_1_posts
wp_4_posts
wp_1_posts
Are you sure you've upgraded properly? Try upgrading to the latest release candidate, or to trunk which has a few unrelated bug fixes.
Ah, I see. You're accessing $wpdb->col_info directly but that's marked as private and get_col_info() which is the API for asking about that says, "Retrieve column metadata from the last query." so it shouldn't be changed by the switch command.
As for upgrading: I've deleted everything off my server, short of the database, and started fresh from Trac a few days ago, after RC1 came out. I ran the upgrade.php file and then ran the upgrade blogs option under site admin. That's all I've ever done in the past.
I'm at a complete loss. The cookie's not getting set correctly, I know this because if I create a cookie, it works just fine. The damned get_permalink() function isn't working. Chaos, man. Chaos. 8D
Sigh.
I should mention that I'm not the only one seeing the problem with switching between blogs:
http://mu.wordpress.org/forums/topic.php?id=8900#post-53265
MrBrian
Member
Posted 17 years ago #
It's quite possible a cache is to blame.
Hmm. . . I'm not running any cache plugins or applications on my own. This is a plain-vanilla installation with no plugins whatsoever. It's possible there's a server cache that's causing the problem. I've discovered that, long since after having removed the directive from my .htaccess file, my domain still gets redirected from http://www.x.tld to x.tld. I've asked my host to look into it, but they've been less than cooperative.
The two problems might be related. I'm close to out of guesses.
DragonFlyEye - <strike>there is no switch_to_blog bug.</strike> Check the bug you opened. Ok, there is some sort of bug I think, but the ticket you opened wasn't a bug. Looking.
Have you tried setting "ADMIN_COOKIE_PATH" to / instead of wp-admin? Define it in wp-config.php as a constant.
Fixed the switch_to_blog bug in 1378. Update your trunk check outs if you're using that!
Donncha,
The switch_to_blog problem seems to be resolved for me, thank you!
Adding the definition of ADMIN_COOKIE_PATH also worked for me. I'll be interested to see when I change hosts whether or not I need to include this definition.
Thank you to you, lunabyte, MrBrain, Andrea and everybody else who helped me along the way. Cheers!
I can't log in to my blog due to the fact that I have a 301 mod rewrite in my .htacess. Once I remove that, I can login, but I don't have the 301 redirect anymore.
Here's what I have in my .htaccess file:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
I have installed wordpress in a subdirectory.
Is there any way I can still keep the 301 redirect and use wordpress at the same time?