MyBB Community Forums

Full Version: [Solved] Deactivation Code Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, so, when I activate a plugin I'm working on, it edits one of the templates to add a link. However, when I deactivate the plugin, it doesn't remove the link that I added. I've tried 'isolating' it by giving it its own line on the template, but that doesn't seem to work. Here's the Deactivation code. If you need the part of the activation code where I add the link, let me know.

<?php
function modcp_deactivate()
{
	global $db;

	$db->delete_query(TABLE_PREFIX."settinggroups", "name='modcp' OR name='Mod CP'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN(
		'modcp_onoff',
		'modcp_ban',
		'modcp_ban_ip',
		'modcp_ban_email',
		'modcp_announce',
		'modcp_thread_queue',
		'modcp_post_queue'
	)");
	$db->delete_query(TABLE_PREFIX."templates", "title='header_welcomeblock_member_mod'");
	$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."modoptions, ".TABLE_PREFIX."modsessions");

	// Attempt to modify header_welcome_block for the memeber template
	require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("header_welcomeblock_member", '#{$modcplink}#', '', 0);
	
	if(isset($config[mod_dir]))
	{
		unset($config[mod_dir]);
	}
	
	echo "<script language=\"JavaScript\">
		  	parent.nav.location.href =  \"./index.php?".SID."&action=navigation\";
		  </script>";
}
?>