Employee Post

Checking Plugin Activation Status on Multisite Networks

Recently Chris Reynolds brought up an issue he was experiencing with one of our client projects; he was struggling to compare the current active status for plugins in a multisite network between internal dev servers and a WPEngine staging site so that he could debug some issues that were occurring.

Everyone on the project wondered if there was some easy way that we could get a snapshot of what each install had going on. The only requirement that Chris wanted was an easy copy/paste way to get the cumulative status from each so he could compare side by side. This set my brain running and I was granted the task to explore what could be done to accomplish this.

After some research, I got set out on the task and the end result became “WDS Active Plugin Data.” It is a multi-site dependent plugin that will only show up in the Network Admin settings submenu once activated.

Views

When you visit the settings page, you will be presented with a basic screen that provides three different view links at the top and the initial “Simple” view displayed below.

Simple View

With “Simple” view, you are presented with each plugin listed on their own line and their current status. Status is indicated by either blank space for not active, “[A]” for active, and “[NA]”” for network active right after the plugin name. This is all presented in a basic textarea that is non-editable and will auto-select all of the contents for easy copying.

wds-active-plugin-data-simple

Advanced View

While probably not THAT advanced, the “Advanced” view is not as compact in its listing compared to “Simple” view. It will list the plugins with two more columns for “Active” and “Network Active.” Each plugin will have its current status indicated by either “true” or “false” in the corresponding column.

wds-active-plugin-data-advanced

Sites List View

The last view we have is the “Sites List” view. With this one, we extrapolate the data and apply it to each site in the network. This will allow you to see which plugins are active in which sites, but does not denote status of “Network activation.” When the plugin is active for a site, its corresponding cell will be green with a checkmark in it, and when inactive, red with an x in it.

wds-active-plugin-data-sites-list

Summary

With the three available views, it is easy to see what plugins you have available, and where each is currently active. When working on client work, comparison of the status between development and production sites, or between two development sites is right at your fingertips.

You can find the plugin on our company GitHub page at https://github.com/WebDevStudios/WDS-Active-Plugin-Data or as a direct zip file download.

Comments

20 thoughts on “Checking Plugin Activation Status on Multisite Networks

  1. Wow, thanks for this, Michael! Yesterday I was doing a plugin audit and cleanup on a Multisite, and needed to figure out which sites were using which plugins. A couple minutes of googling led me to this post. The “Toggle Sites List” feature was super helpful! You should submit this to the Plugin Directory; I’m sure others would find it useful.

  2. Hey, this has been really helpful, but I’ve noticed in ‘Sites List’ mode there seems to be a limit to how many sites will be displayed horizontally?

    I can only get it to display the first 100 sites in the network, is that right, is there anyway to fix this, or shall I just fish in the code?

    1. Looks like you’ve hit the default amount that the `get_sites` function fetches: https://github.com/WebDevStudios/WDS-Active-Plugin-Data/blob/master/wds-active-plugin-data.php#L70

      You would need to amend that line to be something like: `$this->sites = get_sites( array( ‘deleted’ => false, ‘number’ => -1 ) );`

      May need to tinker a little if the “-1” value doesn’t work, and just make that value higher than your total network sites in your install.

      Source: https://developer.wordpress.org/reference/functions/get_sites/

    2. Not sure then. I admittedly don’t presently have a local install that large so I’d need to set one up to do any testing. Otherwise, I’d probably just inspect the function guts for get_sites() and mentally trace my way through. Logically, that function is going to be the source of the limit, at this point.

      1. No worries, I’m half way there!

        I tried: get_sites( array( “deleted” => “false”, “number” => “1500”, ) );

        However, this only populates the “Plugin Name / Site ID” row with site IDs and not the rows underneath with the plugin active/not active data!

        Any other ideas? I’m not a coder but I’ll keep hacking away…

    3. Have you always been doing the number value in quotes? Or were either of your attempts without? I’m curious if the function isn’t liking the number being passed as a string.

    4. Just saying, you’d want to change the code to read as follows exactly, so that it passes the number value as an integer, and not a string.

      $this->sites = get_sites( array( ‘deleted’ => false, ‘number’ => 1500 ) );

      1. I changed it back to get_sites( array( ‘deleted’ => ‘false’, ‘number’ => 1500, ) );

        I still just get the top row of the table and no plugin data, our dev is going to look at it when he gets a chance, but thanks for the pointers.

  3. Thank you! Was looking exactly for this! Will you publish it in the WP plugin repo too?
    Small suggestion, if I may: instead of having 3 views, why not using the Site one, with just an extra icon at the end, in case of Network Activated?

    1. Hi Duke,

      No present plans to push up to WordPress.org but it’s definitely something we could consider in the future. I would also want to do a spot check on the code and compatibility before do that too, to make sure it’s top notch.

      Regarding the views available, probably some room for consolidation as well. If I were tasked up to clean this up now, I’d probably ditch the simple view and explore consolidation into 1 view as well. However, we need to consider others who may have it installed and suddenly get a notification of an update.

Have a comment?

Your email address will not be published. Required fields are marked *

accessibilityadminaggregationanchorarrow-rightattach-iconbackupsblogbookmarksbuddypresscachingcalendarcaret-downcartunifiedcouponcrediblecredit-cardcustommigrationdesigndevecomfriendsgallerygoodgroupsgrowthhostingideasinternationalizationiphoneloyaltymailmaphealthmessagingArtboard 1migrationsmultiple-sourcesmultisitenewsnotificationsperformancephonepluginprofilesresearcharrowscalablescrapingsecuresecureseosharearrowarrowsourcestreamsupporttwitchunifiedupdatesvaultwebsitewordpress