MyBB Community Forums
[Solved] Deactivation Code Problem - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: [Solved] Deactivation Code Problem (/thread-23280.html)



[Solved] Deactivation Code Problem - LegosJedi - 02-16-2007

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>";
}
?>