restore_current_blog() vs. multiple switch_to_blog() followed by removing $GLOBALS[‘_wp_switched_stack’]

Short answer is NO. That is an ugly hack =) More global variables are affect than the ones that you are var_dump’ing. Here are the globals that I found affected: $wpdb, $wp_roles, $wp_object_cache, $global_groups, $GLOBALS[‘_wp_switched_stack’], $GLOBALS[‘blog_id’], and $GLOBALS[‘table_prefix’]. There could be more. I found that $wpdb was another major variable that was altered by switch_to_blog(). … Read more

subdomain archiving

We also covered this in the wordpress.org forums. 🙂 the answer is no. Our sugestion was to make the main site a landing page and set up each year on their subdomains, just like the WordCamp.org site does now. “archiving” a site in multisite basically shuts it down. (See Network Admin -> Sites) so that’s … Read more

Redirect all users, except network administrators, from the main site to a subsite

You’ll need to tie into template_redirect hook where you will check the site and the user and then redirect if needed. function redirect_to_subsite() { if( is_main_site() && !current_user_can(‘manage_network’) ) { $blog_id = 5; // <<—– Update the ID to the subsite blog ID you want to redirect to wp_redirect( get_site_url( $blog_id ) ); exit(); } … Read more

Protect Uploads in Multisite

You’ve got some issues in your underlying objective … For example, I have a filed called 40c.jpg located at localhost/files/2011/07/40c.jpg OK, this makes sense and is where the image should be in the first place. I want the file to show up only when called by HTML on the local domain (here: localhost). So not … Read more

BuddyPress on Multisite [closed]

John James Jacoby, Lead developer of BuddyPress said this. BuddyPress sits on top of an entire WordPress installation, regardless of configuration. That means on single-site, multi-site, or multi-network installations, BuddyPress only has 1 set of data tables. As a result, you only have 1 set of Groups, Activity, Private Messages, Profiles, and Friends, even if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)