version-conflict-check.php 795 Bytes
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?php
//It's not possible to have two versions of this plugin active at the same time. Abort plugin load
//and display an error if we detect that another version has already been loaded.
if ( class_exists('WPMenuEditor') ) {

	function ws_ame_activation_conflict() {
		if ( !current_user_can('activate_plugins') ) {
			return; //The current user can't do anything about the problem.
		}
		?>
		<div class="error fade">
			<p>
				<strong>Error: Another version of Admin Menu Editor is already active.</strong><br>
				Please deactivate the older version. It is not possible to run two different versions
				of this plugin at the same time.
			</p>
		</div>
	<?php
	}

	add_action('admin_notices', 'ws_ame_activation_conflict');
	return true; //Conflict detected.
}

return false; //No conflict.