How to uninstall MailPress (MailPress Uninstall problems)
Posted: Tue Jul 12, 2011 3:24 pm
When you try to delete MailPress 5.1 plug-in from WordPress, If you are getting an error which says MP_uninstall not found, here is a quick solution for you.
Open uninstall.php which is under /wp-content/plugins/mailpress/ and replace the entire content with the following code. Note that this class can be found inside a folder in the MailPress installation. If you are using a higher version than 5.1, make sure to replace the code from that.
Open uninstall.php which is under /wp-content/plugins/mailpress/ and replace the entire content with the following code. Note that this class can be found inside a folder in the MailPress installation. If you are using a higher version than 5.1, make sure to replace the code from that.
Code: Select all
<?php
class MP_uninstall
{
function __construct()
{
global $wpdb;
// taxonomies
$taxonomies = array('MailPress_mailing_list', 'MailPress_autoresponder');
foreach($taxonomies as $taxonomy)
{
$queries[] = "DELETE FROM $wpdb->terms WHERE term_id IN (SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy');";
$queries[] = "DELETE FROM $wpdb->term_relationships WHERE term_id IN (SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy');";
$queries[] = "DELETE FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy';";
}
// postmeta
$queries[] = "DELETE FROM $wpdb->postmeta WHERE meta_key like '%_MailPress%';";
$queries[] = "DELETE FROM $wpdb->postmeta WHERE meta_key like '%_mailpress%';";
// usermeta
$queries[] = "DELETE FROM $wpdb->usermeta WHERE meta_key like '%_MailPress%';";
$queries[] = "DELETE FROM $wpdb->usermeta WHERE meta_key like '%_mailpress%';";
// options
$queries[] = "DELETE FROM $wpdb->options WHERE option_name like '%MailPress%';";
$queries[] = "DELETE FROM $wpdb->options WHERE option_name like '%mailpress%';";
// mailpress tables
$queries[] = "DROP TABLE $wpdb->mp_stats;";
$queries[] = "DROP TABLE $wpdb->mp_mails;";
$queries[] = "DROP TABLE $wpdb->mp_mailmeta;";
$queries[] = "DROP TABLE $wpdb->mp_users;";
$queries[] = "DROP TABLE $wpdb->mp_usermeta;";
$queries[] = "DROP TABLE $wpdb->mp_tracks;";
$queries[] = "DROP TABLE $wpdb->mp_forms;";
$queries[] = "DROP TABLE $wpdb->mp_fields;";
foreach($queries as $query) $wpdb->query($query);
}
}
new MP_uninstall();
?>