Skip to:
Content

bbPress.org

Changeset 4401


Ignore:
Timestamp:
11/12/2012 06:39:41 AM (9 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress:

  • Update group-repair tool to update the group forums root.
  • Also rename the 'Default Forum' to 'Group Forums' since it's part of the sitewide forums now.
  • See #2025, #1669.
File:
1 edited

Legend:

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

    r4400 r4401  
    339339            ++$count;
    340340        }
     341    }
     342
     343    // Make some logical guesses at the old group root forum
     344    if ( function_exists( 'bp_forums_parent_forum_id' ) ) {
     345        $old_default_forum_id = bp_forums_parent_forum_id();
     346    } elseif ( defined( 'BP_FORUMS_PARENT_FORUM_ID' ) ) {
     347        $old_default_forum_id = (int) BP_FORUMS_PARENT_FORUM_ID;
     348    } else {
     349        $old_default_forum_id = 1;
     350    }
     351
     352    // Try to get the group root forum
     353    $posts = get_posts( array(
     354        'post_type'   => bbp_get_forum_post_type(),
     355        'meta_key'    => '_bbp_old_forum_id',
     356        'meta_value'  => $old_default_forum_id,
     357        'numberposts' => 1
     358    ) );
     359
     360    // Found the group root forum
     361    if ( ! empty( $posts ) ) {
     362
     363        // Rename the group root, since it's now visible in sitewide forums
     364        wp_update_post( array(
     365            'ID'         => $posts[0]->ID,
     366            'post_title' => __( 'Group Forums', 'bbpress' ),
     367        ) );
     368
     369        // Update the group forums root metadata
     370        update_option( '_bbp_group_forums_root_id', $posts[0]->ID );
    341371    }
    342372
Note: See TracChangeset for help on using the changeset viewer.