Skip to:
Content

bbPress.org

Changeset 5174


Ignore:
Timestamp:
11/23/2013 12:45:57 PM (11 years ago)
Author:
johnjamesjacoby
Message:

If not deleting users, delete the imported user meta-data instead. See #1889. Props netweb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/admin/tools.php

    r5173 r5174  
    11571157                                <legend class="screen-reader-text"><span><?php esc_html_e( "Say it ain't so!", 'bbpress' ); ?></span></legend>
    11581158                                <label><input type="checkbox" class="checkbox" name="bbpress-delete-imported-users" id="bbpress-delete-imported-users" value="1" /> <?php esc_html_e( 'This option will delete all previously imported users, and cannot be undone.', 'bbpress' ); ?></label>
     1159                                <p class="description"><?php esc_html_e( 'Note: Resetting without this checked will delete the meta-data necessary to delete these users.', 'bbpress' ); ?></p>
    11591160                            </fieldset>
    11601161                        </td>
     
    12431244    /** User ******************************************************************/
    12441245
     1246    // Delete users
    12451247    if ( !empty( $_POST['bbpress-delete-imported-users'] ) ) {
    12461248        $sql_users  = $wpdb->get_results( "SELECT `user_id` FROM `{$wpdb->usermeta}` WHERE `meta_key` = '_bbp_user_id'", OBJECT_K );
     
    12601262            $messages[] = sprintf( $statement, $result );
    12611263        }
     1264
     1265    // Delete imported user metadata
     1266    } else {
     1267        $statement  = __( 'Deleting User Meta&hellip; %s', 'bbpress' );
     1268        $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `meta_key` LIKE '%%_bbp_%%';";
     1269        $result     = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success;
     1270        $messages[] = sprintf( $statement, $result );
    12621271    }
    12631272
Note: See TracChangeset for help on using the changeset viewer.