Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/07/2024 02:09:47 PM (2 years 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.

Fixes #9210 (branch 14.0)

File:
1 edited

Legend:

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

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