Ticket #1889: 1889.diff
File 1889.diff, 3.0 KB (added by , 11 years ago) |
---|
-
includes/admin/tools.php
diff --git a/includes/admin/tools.php b/includes/admin/tools.php index f46c9cc..abbc9c7 100644
a b function bbp_admin_reset() { 1088 1088 </td> 1089 1089 </tr> 1090 1090 <tr valign="top"> 1091 <th scope="row"><?php esc_html_e( 'Delete imported users?', 'bbpress' ) ?></th> 1092 <td> 1093 <fieldset> 1094 <legend class="screen-reader-text"><span><?php esc_html_e( "Say it ain't so!", 'bbpress' ) ?></span></legend> 1095 <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 users previously imported and cannot be undone.', 'bbpress' ); ?></label> 1096 <p><?php esc_html_e( "You only get one shot at this, if you reset the forums without deleting the imported users subsequent forum resets will NOT delete imported users.", 'bbpress' ) ?></p> 1097 </fieldset> 1098 </td> 1099 </tr> 1100 <tr valign="top"> 1091 1101 <th scope="row"><?php esc_html_e( 'Are you sure you want to do this?', 'bbpress' ) ?></th> 1092 1102 <td> 1093 1103 <fieldset> … … function bbp_admin_reset_handler() { 1168 1178 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1169 1179 $messages[] = sprintf( $statement, $result ); 1170 1180 1171 /** User Meta*********************************************************/1181 /** User **************************************************************/ 1172 1182 1173 $statement = __( 'Deleting User Meta… %s', 'bbpress' ); 1174 $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `meta_key` LIKE '%%_bbp_%%';"; 1175 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1176 $messages[] = sprintf( $statement, $result ); 1183 if ( ! bbp_is_post_request() || !empty( $_POST['bbpress-delete-imported-users'] ) ) { 1184 $sql_users = $wpdb->get_results( "SELECT `user_id` FROM `{$wpdb->usermeta}` WHERE `meta_key` = '_bbp_user_id'", OBJECT_K ); 1185 if ( !empty( $sql_users ) ) { 1186 foreach ( $sql_users as $key => $value ) { 1187 $sql_meta[] = $key; 1188 } 1189 $statement = __( 'Deleting User… %s', 'bbpress' ); 1190 $sql_meta = implode( "', '", $sql_meta ); 1191 $sql_delete = "DELETE FROM `{$wpdb->users}` WHERE `ID` IN ('{$sql_meta}');"; 1192 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1193 $messages[] = sprintf( $statement, $result ); 1194 $statement = __( 'Deleting User Meta… %s', 'bbpress' ); 1195 $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `user_id` IN ('{$sql_meta}');"; 1196 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1197 $messages[] = sprintf( $statement, $result ); 1198 } 1199 } else { 1200 $statement = __( 'Deleting User Meta… %s', 'bbpress' ); 1201 $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `meta_key` LIKE '%%_bbp_%%';"; 1202 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1203 $messages[] = sprintf( $statement, $result ); 1204 } 1177 1205 1178 1206 /** Converter *********************************************************/ 1179 1207