Site by Site Activation for Simple Ads

Background: We want to offer bloggers an easy way to insert AdSense, js or other ad code on their sites. I've looked at the Ad Injection plugin DavidM suggested in another topic but it would be way over the heads of most our users with so many configuration options. And Smart Ads hasn't been updated in a few years.

First of all, thanks for all the great plugins and support, and for writing code that even a PHP novice like me can hack with relative ease.

Second, please consider this a feature request for the next Simple Ads update to include a Super Admin option for allowing activation on a site by site basis.

Third, I wanted to share how I hacked simple-ads.php to get the plugin working on sub-sites of our network.

I read in another topic that Simple Ads is now compatible with single WP installs, but when I activated it only on a test sub-site of our network, I found no admin menu anywhere for Simple Ads configuration on that site.

So I removed the multisite condition for the settings page as follows...

Replace lines 32-43:

if (is_multisite()) {
	if ( version_compare($wp_version, '3.0.9', '>') ) {
		$simple_ads_settings_page = 'settings.php';
		$simple_ads_settings_page_long = 'network/settings.php';
	} else {
		$simple_ads_settings_page = 'ms-admin.php';
		$simple_ads_settings_page_long = 'ms-admin.php';
	}
} else {
	$simple_ads_settings_page = 'options-general.php';
	$simple_ads_settings_page_long = 'options-general.php';
}

With:

$simple_ads_settings_page = 'options-general.php';
$simple_ads_settings_page_long = 'options-general.php';

There was still no Advertising menu so I dug deeper into the plugin and found an action commented out...

Replace lines 67-72:

// add_action('admin_menu', 'simple_ads_pages');
if (is_multisite()) {
	add_action('network_admin_menu', 'simple_ads_network_pages');
} else {
	add_action('admin_menu', 'simple_ads_pages');
}

With:

add_action('admin_menu', 'simple_ads_pages');
// if (is_multisite()) {
// 	add_action('network_admin_menu', 'simple_ads_network_pages');
// } else {
// 	add_action('admin_menu', 'simple_ads_pages');
// }

NOTE: Use at your own risk! This seems to be working for me so far, but I offer it with no guarantee, and I would really like to avoid further hacking when the plugin is updated. hint... hint...