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

Shared upload folder in wordpress multisite

This will force uploads for all sites to the wp-content/uploads directory. Sub-directories (like year/month) will still exist (if the setting is enabled). /** * Force all network uploads to reside in “wp-content/uploads”, and by-pass * “files” URL rewrite for site-specific directories. * * @link http://wordpress.stackexchange.com/q/147750/1685 * * @param array $dirs * @return array */ function … Read more

Nginx rules for subdomain multisite install (Bedrock)

Ok some wise guy deleted my last post. The answer, which the above member (@etc) gave to me on another forum, and is working quite fine, is as follows: # Rewrites for Bedrock Multi-Site Subdomain Setup rewrite /wp-admin$ $scheme://$host$uri/ last; rewrite ^/(wp-.*.php)$ /wp/$1 last; rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last; He revised his answer but did not … Read more

Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php

I managed to order the link-manager.php by a custom column using this: /* * Sort links using the custom column link_image */ function sort_on_field(&$objects, $on, $order=”ASC”) { $comparer = ($order === ‘DESC’) ? “return -strcmp(\$a->{$on},\$b->{$on});” : “return strcmp(\$a->{$on},\$b->{$on});”; usort($objects, create_function(‘$a,$b’, $comparer)); } function brsfl_link_manager_order($links) { global $current_screen; if($current_screen->id == ‘link-manager’ && $_GET[‘orderby’] == ‘link_image’) { … Read more