WordPress.org

Plugin Directory

wp-contact-form

Opened 9 years ago

Closed 16 months ago

#128 closed enhancement (fixed)

Add unistall option for wp-contactform

Reported by: soteke Owned by: ryanduff
Priority: normal Severity: normal
Plugin: wp-contact-form Keywords:
Cc:

Description

Perhaps it would be a goog thing if people could uninstall the plugin by deleting the options inserted into the database. If you think this is a goof idea, hope the following code will help:

<div class="wrap" id="uninstall">
<h2>Uninstall Plugin</h2>
<p> To uninstall this plugin (erase the options this plugin ads to your database) please write 'Uninstall' in the following form and press the 'Go' button.<p>
<form name="uninstall_wpcf" method="POST">
<INPUT TYPE="text" NAME="confirmation" size="40" value="">
<input type="submit" name="erase" value="Go">
</div>

<?
global $wpdb, $table_prefix;
if(isset($_REQUESTerase?) && $_POSTconfirmation?=='Uninstall'){

$wpdb->query("DELETE FROM {$table_prefix}options WHERE option_name = 'wpcf_email'");
$wpdb->query("DELETE FROM {$table_prefix}options WHERE option_name = 'wpcf_show_quicktag'");
$wpdb->query("DELETE FROM {$table_prefix}options WHERE option_name = 'wpcf_error_msg'");
$wpdb->query("DELETE FROM {$table_prefix}options WHERE option_name = 'wpcf_success_msg'");
$wpdb->query("DELETE FROM {$table_prefix}options WHERE option_name = 'wpcf_subject'");
echo "<div class='wrap'>Options were deleted successfully please deactivate the plugin to complete uninstall.</div>";
die();

}
?>

Change History (2)

comment:1 ryanduff9 years ago

Wordpress 1.6 has just added plugin hooks for things to run on the loading/unloading of plugins. WPCF 2.0 is possibly being targeted at the Wordpress 1.6 release and will include a removal function.

Besides, there's no need for a complex SQL query, its built into wordpress already...
add_option(), update_option(), and delete_option()

comment:2 qurl16 months ago

  • Resolution set to fixed
  • Status changed from new to closed

In 639724:


fixed #128: Move version one up to trigger release package


Note: See TracTickets for help on using tickets.