Skip to content

Commit

Permalink
Uninstall procedure bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
viruthagiri committed Dec 14, 2016
1 parent 9ad5b83 commit 6901969
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
17 changes: 1 addition & 16 deletions bp-compliments.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ function bp_compliments_activate() {
if ( is_admin() ) {
register_activation_hook( __FILE__, 'bp_compliments_activate' );
register_deactivation_hook( __FILE__, 'bp_compliments_deactivate' );
add_filter( 'geodir_plugins_uninstall_settings', 'bp_compliments_uninstall_settings', 10, 1 );
add_action( 'admin_init', 'bp_compliments_activation_redirect' );
}

Expand Down Expand Up @@ -188,18 +187,4 @@ function bp_compliments_older_version_notice() {
$older_version_notice = __( "Hey! BP Compliments requires BuddyPress 1.5 or higher.", 'bp-compliments' );

echo '<div class="error"><p>' . $older_version_notice . '</p></div>';
}

/**
* Add the plugin to uninstall settings.
*
* @since 1.0.7
*
* @return array $settings the settings array.
* @return array The modified settings.
*/
function bp_compliments_uninstall_settings($settings) {
$settings[] = plugin_basename(dirname(__FILE__));

return $settings;
}
}
13 changes: 13 additions & 0 deletions includes/bp-compliments-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function bp_compliments_register_settings() {
register_setting( 'bp-compliment-settings', 'bp_compliment_enable_notifications' );
register_setting( 'bp-compliment-settings', 'bp_comp_per_page' );
register_setting( 'bp-compliment-settings', 'bp_comp_custom_css' );
register_setting( 'bp-compliment-settings', 'bp_compliment_uninstall_delete');
}

function bp_compliments_settings_page() {
Expand Down Expand Up @@ -61,6 +62,9 @@ function bp_compliments_settings_page() {

$comp_custom_css_value = esc_attr( get_option('bp_comp_custom_css'));
$comp_custom_css = $comp_custom_css_value ? $comp_custom_css_value : '';

$bp_compliment_uninstall_delete_value = esc_attr( get_option('bp_compliment_uninstall_delete'));
$bp_compliment_uninstall_delete = $bp_compliment_uninstall_delete_value ? $bp_compliment_uninstall_delete_value : 'no';
?>
<table class="widefat fixed" style="padding:10px;margin-top: 10px;">
<tr valign="top">
Expand Down Expand Up @@ -130,6 +134,15 @@ function bp_compliments_settings_page() {
<th scope="row"><?php echo __( 'Custom CSS styles', 'bp-compliments' ); ?></th>
<td><textarea class="widefat" rows="5" name="bp_comp_custom_css"><?php echo $comp_custom_css; ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row"><?php echo sprintf( __( 'Delete plugin data when you uninstall BuddyPress Compliments?', 'bp-compliments' ), BP_COMP_PLURAL_NAME ); ?></th>
<td>
<select id="bp_compliment_uninstall_delete" name="bp_compliment_uninstall_delete">
<option value="yes" <?php selected( $bp_compliment_uninstall_delete, 'yes' ); ?>><?php echo __( 'Yes', 'bp-compliments' ); ?></option>
<option value="no" <?php selected( $bp_compliment_uninstall_delete, 'no' ); ?>><?php echo __( 'No', 'bp-compliments' ); ?></option>
</select>
</td>
</tr>
<tr valign="top">
<th></th>
<td><?php submit_button(null, 'primary','submit',false); ?></td>
Expand Down
2 changes: 1 addition & 1 deletion uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

global $wpdb, $bp;

if ( get_option( 'geodir_un_buddypress-compliments' ) ) {
if ( get_option( 'bp_compliment_uninstall_delete' ) ) {
$wpdb->hide_errors();

if ( !defined( 'BP_COMPLIMENTS_VER' ) ) {
Expand Down

0 comments on commit 6901969

Please sign in to comment.