Changeset 4731
- Timestamp:
- 01/28/2013 06:18:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/tools.php
r4704 r4731 306 306 $g_count = 0; 307 307 $f_count = 0; 308 $s_count = 0; 308 309 309 310 // Copy the BuddyPress filter here, incase BuddyPress is not active 310 $prefix = apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ); 311 $tablename = $prefix . 'bp_groups_groupmeta'; 311 $prefix = apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ); 312 $groups_table = $prefix . 'bp_groups'; 313 $groups_meta_table = $prefix . 'bp_groups_groupmeta'; 312 314 313 315 // Get the converted forum IDs … … 335 337 336 338 // Attempt to update group meta 337 $updated = $wpdb->query( "UPDATE `{$ tablename}` SET `meta_value` = '{$group_forums->ID}' WHERE `meta_key` = 'forum_id' AND `meta_value` = '{$group_forums->meta_value}';" );339 $updated = $wpdb->query( "UPDATE `{$groups_meta_table}` SET `meta_value` = '{$group_forums->ID}' WHERE `meta_key` = 'forum_id' AND `meta_value` = '{$group_forums->meta_value}';" ); 338 340 339 341 // Bump the count … … 342 344 } 343 345 344 // Update group 's forum metadata345 $group_id = (int) $wpdb->get_var( "SELECT `group_id` FROM `{$ tablename}` WHERE `meta_key` = 'forum_id' AND `meta_value` = '{$group_forums->ID}';" );346 // Update group to forum relationship data 347 $group_id = (int) $wpdb->get_var( "SELECT `group_id` FROM `{$groups_meta_table}` WHERE `meta_key` = 'forum_id' AND `meta_value` = '{$group_forums->ID}';" ); 346 348 if ( !empty( $group_id ) ) { 349 350 // Update the group to forum meta connection in forums 347 351 update_post_meta( $group_forums->ID, '_bbp_group_ids', array( $group_id ) ); 352 353 // Get the group status 354 $group_status = $wpdb->get_var( "SELECT `status` FROM `{$groups_table}` WHERE `id` = '{$group_id}';" ); 355 356 // Sync up forum visibility based on group status 357 switch ( $group_status ) { 358 359 // Public groups have public forums 360 case 'public' : 361 bbp_publicize_forum( $group_forums->ID ); 362 363 // Bump the count for output later 364 ++$s_count; 365 break; 366 367 // Private/hidden groups have hidden forums 368 case 'private' : 369 case 'hidden' : 370 bbp_hide_forum( $group_forums->ID ); 371 372 // Bump the count for output later 373 ++$s_count; 374 break; 375 } 376 377 // Bump the count for output later 348 378 ++$f_count; 349 379 } … … 390 420 391 421 // Complete results 392 $result = sprintf( __( 'Complete! %s groups updated; %s forums updated .', 'bbpress' ), bbp_number_format( $g_count ), bbp_number_format( $f_count ) );422 $result = sprintf( __( 'Complete! %s groups updated; %s forums updated; %s forum statuses synced.', 'bbpress' ), bbp_number_format( $g_count ), bbp_number_format( $f_count ), bbp_number_format( $s_count ) ); 393 423 return array( 0, sprintf( $statement, $result ) ); 394 424 }
Note: See TracChangeset
for help on using the changeset viewer.