PHP Code:
$q = $db->query_first("SELECT * FROM ". TABLE_PREFIX."pbpg_plugin WHERE dir='chess'");
$q2 = $db->query("SELECT * FROM ".TABLE_PREFIX."pbpg_pluginconfig WHERE pbpg_pluginid = $q[pbpg_pluginid]");
while($row=$db->fetch_array($q2))
{
foreach($vbulletin->forumcache AS $forum)
{
$test = unserialize($forum['pbpg_enabledpluginconfigs']);
if(isset($test[$row['pbpg_pluginconfigid']]))
{
print_cp_message('Error Plugin still in use. Remove all configs using this plugin from forums its enabled in and delete all threads using it before removing the plugin.');
}
}
$threads = $db->query_first("SELECT * FROM ".TABLE_PREFIX."thread WHERE pbpg_pluginconfigid = $row[pbpg_pluginconfigid]");
if(is_array($threads))
{
print_cp_message('Error Plugin still in use. Remove all configs using this plugin from forums its enabled in and delete all threads using it before removing the plugin.');
}
}
$db->query_write("DELETE FROM ".TABLE_PREFIX."pbpg_pluginconfig WHERE pbpg_pluginid = $q[pbpg_pluginid]");
$db->query_write("DELETE FROM ". TABLE_PREFIX."pbpg_plugin WHERE pbpg_pluginid = $q[pbpg_pluginid]");
That will do it, however you should remove any configs that use the plugin from the forums you have them enabled in first.
The next version will ship with uninstall code.
Edit: updated with safer uninstall code.