Changeset 11080 for trunk/src/bp-core/bp-core-update.php
- Timestamp:
- 09/10/2016 02:25:50 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-update.php
r10941 r11080 266 266 267 267 // Version 2.7.0. 268 if ( $raw_db_version < 1 0940) {268 if ( $raw_db_version < 11079 ) { 269 269 bp_update_to_2_7(); 270 270 } … … 395 395 * a manual filter) to restore it. In 1.9.2, we add an option that flags 396 396 * whether bp-default or a child theme is active at the time of upgrade; if so, 397 * 397 398 * the theme directory will continue to be registered even if the theme is 398 399 * deactivated temporarily. Thus, new installations will not see bp-default, … … 510 511 * - Add email unsubscribe salt. 511 512 * 513 * - Save legacy directory titles to the corresponding WP pages. 514 * 512 515 * @since 2.7.0 513 516 */ 514 517 function bp_update_to_2_7() { 515 518 bp_add_option( 'bp-emails-unsubscribe-salt', base64_encode( wp_generate_password( 64, true, true ) ) ); 519 520 // Update post_titles 521 bp_270_migrate_directory_page_titles(); 516 522 } 517 523 … … 564 570 565 571 /** 572 * Update WP pages so that their post_title matches the legacy component directory title. 573 * 574 * As of 2.7.0, component directory titles come from the `post_title` attribute of the corresponding WP post object, 575 * instead of being hardcoded. To ensure that directory titles don't change for existing installations, we update these 576 * WP posts with the formerly hardcoded titles. 577 * 578 * @since 2.7.0 579 */ 580 function bp_270_migrate_directory_page_titles() { 581 $bp_pages = bp_core_get_directory_page_ids( 'all' ); 582 583 $default_titles = bp_core_get_directory_page_default_titles(); 584 585 $legacy_titles = array( 586 'activity' => _x( 'Site-Wide Activity', 'component directory title', 'buddypress' ), 587 'blogs' => _x( 'Sites', 'component directory title', 'buddypress' ), 588 'groups' => _x( 'Groups', 'component directory title', 'buddypress' ), 589 'members' => _x( 'Members', 'component directory title', 'buddypress' ), 590 ); 591 592 foreach ( $bp_pages as $component => $page_id ) { 593 if ( ! isset( $legacy_titles[ $component ] ) ) { 594 continue; 595 } 596 597 $page = get_post( $page_id ); 598 if ( ! $page ) { 599 continue; 600 } 601 602 // If the admin has changed the default title, don't touch it. 603 if ( isset( $default_titles[ $component ] ) && $default_titles[ $component ] !== $page->post_title ) { 604 continue; 605 } 606 607 // If the saved page title is the same as the legacy title, there's nothing to do. 608 if ( $legacy_titles[ $component ] == $page->post_title ) { 609 continue; 610 } 611 612 // Update the page with the legacy title. 613 wp_update_post( array( 614 'ID' => $page_id, 615 'post_title' => $legacy_titles[ $component ], 616 ) ); 617 } 618 } 619 620 /** 566 621 * Redirect user to BP's What's New page on first page load after activation. 567 622 *
Note: See TracChangeset
for help on using the changeset viewer.