Skip to:
Content

BuddyPress.org

Ticket #5747: 5747.patch

File 5747.patch, 881 bytes (added by johnjamesjacoby, 11 years ago)

Patched against bp-core-functions.php directly

  • bp-core-functions.php

     
    507507
    508508        // Create the pages
    509509        foreach ( $pages_to_create as $component_name => $page_name ) {
    510                 $pages[ $component_name ] = wp_insert_post( array(
    511                         'comment_status' => 'closed',
    512                         'ping_status'    => 'closed',
    513                         'post_status'    => 'publish',
    514                         'post_title'     => $page_name,
    515                         'post_type'      => 'page',
    516                 ) );
     510                $exists = get_page_by_path( $component_name );
     511
     512                // If page already exists, use it
     513                if ( ! empty( $exists ) ) {
     514                        $pages[ $component_name ] = $exists->ID;
     515                } else {
     516                        $pages[ $component_name ] = wp_insert_post( array(
     517                                'comment_status' => 'closed',
     518                                'ping_status'    => 'closed',
     519                                'post_status'    => 'publish',
     520                                'post_title'     => $page_name,
     521                                'post_type'      => 'page',
     522                        ) );
     523                }
    517524        }
    518525
    519526        // Save the page mapping