Skip to:
Content

BuddyPress.org

Changeset 13632


Ignore:
Timestamp:
11/05/2023 07:32:10 AM (15 months ago)
Author:
imath
Message:

Prevent potential 3rd party plugins/themes issues for new installs

  • Load 12.0 deprecated functions even in new installs.
  • Add an Admin Notification to inform about BP Classic: the BP backwards compatibility Add-on.

Props emaralive, dcavins

Fixes #9015
Closes https://github.com/buddypress/buddypress/pull/183

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r13614 r13632  
    48864886    $load_latest_deprecated = $initial_version < $current_version;
    48874887
    4888     // We don't load deprecated functions for new installs.
     4888    // New installs.
    48894889    if ( ! $load_latest_deprecated ) {
    48904890        // Run some additional checks if PHPUnit is running.
     
    49054905            }
    49064906        }
    4907         return array();
     4907
     4908        // Only load 12.0 deprecated functions.
     4909        return array( '12.0' );
    49084910    }
    49094911
     
    51205122                __( 'If any of the above items are true, we strongly advise you to install and activate the Classic Add-on before updating to BuddyPress 12.0.0.', 'buddypress' ),
    51215123                'version' => 11.4,
    5122         )
     5124        ),
     5125        'bp120-new-installs-warning' => (object) array(
     5126            'id'      => 'bp120-new-installs-warning',
     5127            'href'    => add_query_arg(
     5128                array(
     5129                    'tab'  => 'bp-add-ons',
     5130                    'show' => 'bp-classic',
     5131                    'n'    => 'bp120-new-installs-warning'
     5132                ),
     5133                bp_get_admin_url( 'plugin-install.php' )
     5134            ),
     5135            'text'    => __( 'Get The BP Classic Add-on', 'buddypress' ),
     5136            'title'   => __( 'Thank you for installing BuddyPress 12.0!', 'buddypress' ),
     5137            'content' => __( 'BuddyPress 12.0 introduces major core changes, overhauling the way that BuddyPress builds and parses URLs.', 'buddypress' ) . '<br><br>' .
     5138                __( 'If you find that your site is not working correctly with the new version, try installing the new BP Classic Add-on that adds backwards compatibility for plugins and themes that have not yet been updated to work with BuddyPress 12.0.', 'buddypress' ),
     5139                'version' => 12.0,
     5140        ),
    51235141    );
    51245142
  • trunk/src/bp-core/bp-core-update.php

    r13614 r13632  
    204204    }
    205205
    206     // Install BP schema and activate only Activity and XProfile.
     206    // Install BP schema and activate default components.
    207207    if ( bp_is_install() ) {
    208208        // Set the first BP major version the plugin was installed.
    209209        bp_update_option( '_bp_initial_major_version', bp_get_major_version() );
    210210
    211         // Apply schema and set Activity and XProfile components as active.
     211        // Add an unread Admin notification.
     212        if ( 13422 === bp_get_db_version() ) {
     213            $unread   = bp_core_get_unread_admin_notifications();
     214            $unread[] = 'bp120-new-installs-warning';
     215
     216            bp_update_option( 'bp_unread_admin_notifications', $unread );
     217        }
     218
     219        // Apply schema and set default components as active.
    212220        bp_core_install( $default_components );
    213221        bp_update_option( 'bp-active-components', $default_components );
  • trunk/tests/phpunit/testcases/core/functions.php

    r13431 r13632  
    875875        $versions        = bp_get_deprecated_functions_versions();
    876876
    877         // When current version is the initial version, we shouldn't load deprecated functions files.
    878         $this->assertTrue( is_array( $versions ) && ! $versions, 'Please check the list of `$deprecated_functions_versions` in `bp_get_deprecated_functions_versions()`. There should be one for each file of the `/src/bp-core/deprecated` directory.' );
     877        // When current version is the initial version, we should only load 12.0 deprecated functions file.
     878        $this->assertSame( $versions, array( '12.0' ), 'Please check the list of `$deprecated_functions_versions` in `bp_get_deprecated_functions_versions()`. There should be one for each file of the `/src/bp-core/deprecated` directory.' );
    879879
    880880        // We should load the 2 lasts deprecated functions files.
Note: See TracChangeset for help on using the changeset viewer.