The post Activate WP SlimStat Dashboard Widgets in WordPress Multisite appeared first on Justin Silver.
]]>If you have WordPress Multisite installed and the WP SlimStat plugin activated network wide, the optional WP SlimStat Dashboard widgets won’t be available to you. The problem is that the dashboard widgets file is using get_option('active_plugins')
to see if the plugin is active, and if it’s active network wide it won’t be in this array – it will be in get_site_options('active_sitewide_plugins')
. Rather than modifying the WP SlimStat plugin files (which will be overwritten when you upgrade), I recommend adding the following filter to a custom functions plugin to add the value to the array before it is read by the dashboard widgets. Using functions.php
in your theme is out because get_option()
in the WP SlimStat plugin is called before it loads. You could also use a Must Use Plugin placed in /wp-content/mu-plugins
.
There is some checking to make sure this only happens on the admin index page, but that’s just to be safe – it really shouldn’t have any adverse affects on your site except a few edge cases.
function activate_slimstat_dashboard_multisite($plugins){ // only run on multisite admin index screens. // $pagenow isn't available, so we have to preg_match the SCRIPT_NAME (should work for subdirectories) if (is_multisite() && preg_match("~/wp-admin/index\.php$~", $_SERVER['SCRIPT_NAME'])){ $slimstat_plugin = 'wp-slimstat/wp-slimstat.php'; // check if plugin is active network wide and if so add to site plugins if (array_key_exists($slimstat_plugin, get_site_option('active_sitewide_plugins', array()))) $plugins[] = $slimstat_plugin; } return $plugins; } add_filter( 'option_active_plugins', 'activate_slimstat_dashboard_multisite' );
The post Activate WP SlimStat Dashboard Widgets in WordPress Multisite appeared first on Justin Silver.
]]>The post WordPress Plugin: wp-slimstat-permalinks appeared first on Justin Silver.
]]>This plugin will maintain your WP SlimStat stats history for pages and posts when permalinks change for your page(s) or post(s). It does this by updating your {$wpdb->prefix)slim_stats table replacing the old permalink with the new permalink in the resources column. Your permalinks can change when you update a post slug, date, etc or your permalink structure sitewide.
This file is always up to date based on the trunk of my SVN repository.
<html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.23.1</center> </body> </html>
The post WordPress Plugin: wp-slimstat-permalinks appeared first on Justin Silver.
]]>