MyBB Community Forums

Full Version: problem with plugin Uninstall ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just finished developing a free plugin for community everything is working fine except Uninstall function

At first I was just using Activate/deactivate and it worked fine,but later I devided the code to follow standard,

No what happens is when I click uninstall (in plugin managment) I receive "successfull" message but control link doesn't change i.e from "Uninstall" to "Install" ideally I should see "Install & activate"

I need to know which specific table enetry is associated with it what I'm doing wrong?

below is my code
function mymodtools_uninstall()
{
	global $db;
	$db->delete_query("templates", "title IN('moderation_tools')");


     $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name ='my_address'");
	$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='my_tool'");
	
	rebuild_settings();

}

function mymodtools_deactivate()
{
	include MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("showthread_inlinemoderation", "#".preg_quote('<option value="myconfigtools">{$lang->my_tools}</option>')."#i", '', 0);

}

Huh
Add a *_is_installed function - MyBB needs it to tell whether the plugin is actually installed.
I this case you can check for existence of your plugin's settings:
function plugin_is_installed () {
    global $db;
    $query = $db->simple_select('settinggroups', '*', "name='name'");
    return $db->num_rows($query) > 0;
}
(2014-07-13, 02:44 PM)Devilshakerz Wrote: [ -> ]Add a *_is_installed function - MyBB needs it to tell whether the plugin is actually installed.
I this case you can check for existence of your plugin's settings:
function plugin_is_installed () {
    global $db;
    $query = $db->simple_select('settinggroups', '*', "name='name'");
    return $db->num_rows($query) > 0;
}

Wow man it worked Thanks Smile reps added Heart