diff --git a/includes/admin/tools.php b/bbPress/admin/tools.php
index 8c55d04..93d957e 100644
a
|
b
|
function bbp_admin_repair_group_forum_relationship() { |
313 | 313 | $groups_meta_table = $prefix . 'bp_groups_groupmeta'; |
314 | 314 | |
315 | 315 | // Get the converted forum IDs |
316 | | $forum_ids = $wpdb->query( "SELECT `forum`.`ID`, `forummeta`.`meta_value` |
| 316 | $forum_ids = $wpdb->query( "SELECT `forum`.`ID`, `forummeta`.`meta_value`, `group`.`id` |
317 | 317 | FROM `{$wpdb->posts}` AS `forum` |
318 | 318 | LEFT JOIN `{$wpdb->postmeta}` AS `forummeta` |
319 | 319 | ON `forum`.`ID` = `forummeta`.`post_id` |
320 | 320 | AND `forummeta`.`meta_key` = '_bbp_old_forum_id' |
321 | | WHERE `forum`.`post_type` = 'forum' |
| 321 | LEFT JOIN `{$groups_table}` AS `group` |
| 322 | ON `group`.`slug` = `forum`.`post_name` |
| 323 | WHERE `forum`.`post_type` = 'forum' AND `group`.`id` > 0 |
322 | 324 | GROUP BY `forum`.`ID`;" ); |
323 | 325 | |
324 | 326 | // Bail if forum IDs returned an error |
… |
… |
function bbp_admin_repair_group_forum_relationship() { |
336 | 338 | continue; |
337 | 339 | |
338 | 340 | // Attempt to update group meta |
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}';" ); |
| 341 | $updated = $wpdb->query( "UPDATE `{$groups_meta_table}` SET `meta_value` = '{$group_forums->ID}' WHERE `meta_key` = 'forum_id' AND `group_id` = '{$group_forums->id}';" ); |
340 | 342 | |
341 | 343 | // Bump the count |
342 | 344 | if ( !empty( $updated ) && ! is_wp_error( $updated ) ) { |
… |
… |
function bbp_admin_repair_group_forum_relationship() { |
404 | 406 | wp_update_post( array( |
405 | 407 | 'ID' => $posts[0]->ID, |
406 | 408 | 'post_title' => __( 'Group Forums', 'bbpress' ), |
| 409 | 'post_name' => __( 'group-forums', 'bbpress' ), |
407 | 410 | ) ); |
408 | 411 | } |
409 | 412 | |