Changeset 5173
- Timestamp:
- 11/23/2013 12:35:50 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/tools.php
r5157 r5173 1152 1152 </tr> 1153 1153 <tr valign="top"> 1154 <th scope="row"><?php esc_html_e( ' Are you sure you want to do this?', 'bbpress' )?></th>1154 <th scope="row"><?php esc_html_e( 'Delete imported users?', 'bbpress' ); ?></th> 1155 1155 <td> 1156 1156 <fieldset> 1157 <legend class="screen-reader-text"><span><?php esc_html_e( "Say it ain't so!", 'bbpress' ) ?></span></legend> 1157 <legend class="screen-reader-text"><span><?php esc_html_e( "Say it ain't so!", 'bbpress' ); ?></span></legend> 1158 <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 </fieldset> 1160 </td> 1161 </tr> 1162 <tr valign="top"> 1163 <th scope="row"><?php esc_html_e( 'Are you sure you want to do this?', 'bbpress' ); ?></th> 1164 <td> 1165 <fieldset> 1166 <legend class="screen-reader-text"><span><?php esc_html_e( "Say it ain't so!", 'bbpress' ); ?></span></legend> 1158 1167 <label><input type="checkbox" class="checkbox" name="bbpress-are-you-sure" id="bbpress-are-you-sure" value="1" /> <?php esc_html_e( 'This process cannot be undone.', 'bbpress' ); ?></label> 1159 1168 </fieldset> … … 1203 1212 wp_cache_flush(); 1204 1213 1205 /** Posts ************************************************************* /1214 /** Posts *****************************************************************/ 1206 1215 1207 1216 $statement = __( 'Deleting Posts… %s', 'bbpress' ); … … 1211 1220 $messages[] = sprintf( $statement, $result ); 1212 1221 1213 1214 /** Post Meta *********************************************************/ 1222 /** Post Meta *************************************************************/ 1215 1223 1216 1224 if ( !empty( $sql_posts ) ) { 1225 $sql_meta = array(); 1217 1226 foreach ( $sql_posts as $key => $value ) { 1218 1227 $sql_meta[] = $key; … … 1225 1234 } 1226 1235 1227 /** Topic Tags ******************************************************** /1236 /** Topic Tags ************************************************************/ 1228 1237 1229 1238 $statement = __( 'Deleting Topic Tags… %s', 'bbpress' ); … … 1232 1241 $messages[] = sprintf( $statement, $result ); 1233 1242 1234 /** User Meta *********************************************************/ 1235 1236 $statement = __( 'Deleting User Meta… %s', 'bbpress' ); 1237 $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `meta_key` LIKE '%%_bbp_%%';"; 1238 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1239 $messages[] = sprintf( $statement, $result ); 1240 1241 /** Converter *********************************************************/ 1243 /** User ******************************************************************/ 1244 1245 if ( !empty( $_POST['bbpress-delete-imported-users'] ) ) { 1246 $sql_users = $wpdb->get_results( "SELECT `user_id` FROM `{$wpdb->usermeta}` WHERE `meta_key` = '_bbp_user_id'", OBJECT_K ); 1247 if ( !empty( $sql_users ) ) { 1248 $sql_meta = array(); 1249 foreach ( $sql_users as $key => $value ) { 1250 $sql_meta[] = $key; 1251 } 1252 $statement = __( 'Deleting User… %s', 'bbpress' ); 1253 $sql_meta = implode( "', '", $sql_meta ); 1254 $sql_delete = "DELETE FROM `{$wpdb->users}` WHERE `ID` IN ('{$sql_meta}');"; 1255 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1256 $messages[] = sprintf( $statement, $result ); 1257 $statement = __( 'Deleting User Meta… %s', 'bbpress' ); 1258 $sql_delete = "DELETE FROM `{$wpdb->usermeta}` WHERE `user_id` IN ('{$sql_meta}');"; 1259 $result = is_wp_error( $wpdb->query( $sql_delete ) ) ? $failed : $success; 1260 $messages[] = sprintf( $statement, $result ); 1261 } 1262 } 1263 1264 /** Converter *************************************************************/ 1242 1265 1243 1266 $statement = __( 'Deleting Conversion Table… %s', 'bbpress' ); … … 1251 1274 $messages[] = sprintf( $statement, $result ); 1252 1275 1253 /** Options *********************************************************** /1276 /** Options ***************************************************************/ 1254 1277 1255 1278 $statement = __( 'Deleting Settings… %s', 'bbpress' ); … … 1257 1280 $messages[] = sprintf( $statement, $success ); 1258 1281 1259 /** Roles ************************************************************* /1282 /** Roles *****************************************************************/ 1260 1283 1261 1284 $statement = __( 'Deleting Roles and Capabilities… %s', 'bbpress' ); … … 1265 1288 $messages[] = sprintf( $statement, $success ); 1266 1289 1267 /** Output ************************************************************ /1290 /** Output ****************************************************************/ 1268 1291 1269 1292 if ( count( $messages ) ) {
Note: See TracChangeset
for help on using the changeset viewer.