Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/07/2024 02:08:06 PM (9 months ago)
Author:
imath
Message:

Make sure 12.0 deprecated code is loaded until version 15.0

Version 12.0 changed BuddyPress a lot with the introduction of the BP Rewrites API. To give more time to advanced users, BP plugin or theme developers so that they make their code ready for this API, unlike how we deal with deprecated code since r13304 & for the 2 following major releases (14.0 & 15.0), we will carry on loading it to prevent potential errors.

Props emaralive, espellcaste.

See #9210 (trunk)
Closes https://github.com/buddypress/buddypress/pull/352

File:
1 edited

Legend:

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

    r13991 r13998  
    50135013        }
    50145014
    5015         // Only load 12.0 deprecated functions.
    5016         return array( 12.0 );
    5017     }
    5018 
    5019     $index_first_major = array_search( $initial_version, $deprecated_functions_versions, true );
    5020     if ( false === $index_first_major ) {
    5021         return array_splice( $deprecated_functions_versions, -2 );
    5022     }
    5023 
    5024     $latest_deprecated_functions_versions = array_splice( $deprecated_functions_versions, $index_first_major );
    5025 
    5026     if ( 2 <= count( $latest_deprecated_functions_versions ) ) {
    5027         $latest_deprecated_functions_versions = array_splice( $latest_deprecated_functions_versions, -2 );
    5028     }
    5029 
    5030     $index_initial_version = array_search( $initial_version, $latest_deprecated_functions_versions, true );
    5031     if ( false !== $index_initial_version && 12.0 !== $initial_version ) {
    5032         unset( $latest_deprecated_functions_versions[ $index_initial_version ] );
    5033     }
    5034 
    5035     return $latest_deprecated_functions_versions;
     5015        // Load 12.0 deprecated functions only when BP was installed with 12.0, 14.0 or 15.0.
     5016        if ( in_array( $initial_version, array( 12.0, 14.0, 15.0 ), true ) ) {
     5017            return array( 12.0 );
     5018        }
     5019
     5020        return array();
     5021    }
     5022
     5023    $keep_last = 2;
     5024    if ( (float) 15 >= $initial_version ) {
     5025        $keep_last = count( $deprecated_functions_versions ) - array_search( 12.0, $deprecated_functions_versions, true );
     5026    }
     5027
     5028    return array_splice( $deprecated_functions_versions, -$keep_last );
    50365029}
    50375030
Note: See TracChangeset for help on using the changeset viewer.