WP SlimStat Archives - Justin Silver https://www.justinsilver.com/tag/wp-slimstat/ Technology, Travel, and Pictures Tue, 19 Apr 2016 18:29:12 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.1 https://www.justinsilver.com/wp-content/uploads/2013/06/cropped-apple-touch-icon-160x160.png WP SlimStat Archives - Justin Silver https://www.justinsilver.com/tag/wp-slimstat/ 32 32 Activate WP SlimStat Dashboard Widgets in WordPress Multisite https://www.justinsilver.com/technology/wordpress/activate-wp-slimstat-dashboard-widgets-in-wordpress-multisite/?utm_source=rss&utm_medium=rss&utm_campaign=activate-wp-slimstat-dashboard-widgets-in-wordpress-multisite https://www.justinsilver.com/technology/wordpress/activate-wp-slimstat-dashboard-widgets-in-wordpress-multisite/#comments Wed, 07 Nov 2012 00:24:26 +0000 http://justin.ag/?p=2807 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...

The post Activate WP SlimStat Dashboard Widgets in WordPress Multisite appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

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.

]]>
https://www.justinsilver.com/technology/wordpress/activate-wp-slimstat-dashboard-widgets-in-wordpress-multisite/feed/ 1
WordPress Plugin: wp-slimstat-permalinks https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/?utm_source=rss&utm_medium=rss&utm_campaign=wordpress-plugin-wp-slimstat-permalinks https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/#respond Sun, 04 Nov 2012 04:56:28 +0000 http://justin.ag/?p=2772 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 post WordPress Plugin: wp-slimstat-permalinks appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

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.

wp-slimstat-permalinks.php

<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.

]]>
https://www.justinsilver.com/technology/wordpress/wordpress-plugin-wp-slimstat-permalinks/feed/ 0