WordPress.org

Ready to get started?Download WordPress

Forums

Blank page for superadmin on huge wp network (4 posts)

  1. artilibere
    Member
    Posted 2 years ago #

    Hello, I admin a wordpress network of 10k sites.
    Each site has 2 users: local account, superadmin account.

    So that the superadmin is user of every 10k site.

    That was ok untill v3.3 and untill the new toolbar.
    Now that I upgraded from 3.2.1 to 3.3.1 superadmin cannot login anymore, I think because breaking while assembling the huge 'my sites' list in toolbar.

    I have no error neither in apache nor mysql, and I think that's an untracked memory overflow issue.

    How can I suppress the creation of that list?

    I understand that it have something to do with removing nodes from WP_Admin_Bar instance... but I cannot figure the right way to do that.

    Thanks in advance for all the help,
    Carlo

  2. tribalNerd
    Member
    Posted 2 years ago #

    Hello artilibere,
    That's a lot of sites...

    Add this snip to your functions.php to shut off the my sites menu.

    function removeMySites() {
    	global $wp_admin_bar;
    		$wp_admin_bar->remove_menu('my-sites');
    }
    add_action( 'wp_before_admin_bar_render', 'removeMySites', 0 );

    Someone else may have some better advice, but here is mine.

    You'll need to recreate the my sites menu... it will probably be easier to do several of them rather than just one. Then assign each menu a unique group, wrapping that group/menu in a unique class, then use jquery to stop the loading of that menu, until it's called.

    I have a custom my sites mu plugin, I'll see if I can clean it up and get it posted for you.

    Here's the parts either way:
    http://codex.wordpress.org/Function_Reference/add_menu
    http://codex.wordpress.org/Function_Reference/add_group

    And the 2nd function: Build a network site list... more for the Transient cache feature, which each menu would have a unique one of.

    http://wp.smashingmagazine.com/2011/11/17/wordpress-multisite-practical-functions-methods/

  3. artilibere
    Member
    Posted 2 years ago #

    wow, great answer!

    I'll check if it works.. but I think so.

    Thanks a lot.

  4. It would be better to put that in a plugin in your mu-plugins folder. Functions.php is 100% theme dependant, so if you switch themes (or use a different one on a site) that WON'T work.

    Just make a file like this:

    <?php
    /*
    Plugin Name: Site Functions
    Description: Special site functions for my site
    Author: artilibere
    */
    
    // Remove My Sites from the Toolbar
    function removeMySites() {
    	global $wp_admin_bar;
    		$wp_admin_bar->remove_menu('my-sites');
    }
    add_action( 'wp_before_admin_bar_render', 'removeMySites', 0 );
    ?>

    Call it site-functions.php and put it right in /wp-content/my-plugins

    That will be activated for everyone on your site, mind you, so if you ONLY want to remove sites for certain users accounts, we'll have to wrap things differently. (And yea, a site-functions.php file is a GREAT thing for Multisite if you use a lot of different themes. I love it!)

    I went into some more detail here a while back: http://tech.ipstenu.org/2011/customize-wp-admin-bar/

Topic Closed

This topic has been closed to new replies.

About this Topic