Skip to:
Content

bbPress.org

Changeset 4405


Ignore:
Timestamp:
11/13/2012 05:23:17 AM (13 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress Repair:

  • Repair forum group ID meta so relationship is fully mapped.
  • Update feedback message to include group and forum counts.
  • Props jmdodd.
  • Fixes #2025.
File:
1 edited

Legend:

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

    r4402 r4405  
    303303
    304304    $statement = __( 'Repairing BuddyPress group-forum relationships… %s', 'bbpress' );
    305     $count     = 0;
     305    $g_count     = 0;
     306    $f_count     = 0;
    306307
    307308    // Copy the BuddyPress filter here, incase BuddyPress is not active
     
    337338        // Bump the count
    338339        if ( !empty( $updated ) && ! is_wp_error( $updated ) ) {
    339             ++$count;
     340            ++$g_count;
     341        }
     342
     343        // Update group's forum metadata
     344        $group_id = (int) $wpdb->get_var( "SELECT `group_id` FROM `{$tablename}` WHERE `meta_key` = 'forum_id' AND `meta_value` = '{$group_forums->ID}';" );
     345        if ( !empty( $group_id ) ) {
     346            update_post_meta( $group_forums->ID, '_bbp_group_ids', array( $group_id ) );
     347            ++$f_count;
    340348        }
    341349    }
     
    374382
    375383    // Complete results
    376     $result = sprintf( __( 'Complete! %s group forums updated.', 'bbpress' ), bbp_number_format( $count ) );
     384    $result = sprintf( __( 'Complete! %s groups updated; %s forums updated.', 'bbpress' ), bbp_number_format( $g_count ), bbp_number_format( $f_count ) );
    377385    return array( 0, sprintf( $statement, $result ) );
    378386}
Note: See TracChangeset for help on using the changeset viewer.