Skip to:
Content

BuddyPress.org

Changeset 13477


Ignore:
Timestamp:
05/13/2023 11:47:21 AM (18 months ago)
Author:
imath
Message:

Move some 12.0.0 deprecated functions behind a BP Classic plugin check

The BP Classic plugin will include these deprecated functions as the plugin is forcing the BP Legacy URL parser usage & pretty permalinks.

Fixes #8895

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

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

    r13431 r13477  
    1212defined( 'ABSPATH' ) || exit;
    1313
    14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not used page association anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not use page association anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
  • trunk/src/bp-core/deprecated/12.0.php

    r13471 r13477  
    185185        _deprecated_function( __FUNCTION__, '12.0.0' );
    186186    }
     187
     188    /**
     189     * Return the username for a user based on their user id.
     190     *
     191     * This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE,
     192     * so it will return the user_login or user_nicename as appropriate.
     193     *
     194     * @since 1.0.0
     195     * @deprecated 12.0.0
     196     *
     197     * @param int         $user_id       User ID to check.
     198     * @param string|bool $user_nicename Optional. user_nicename of user being checked.
     199     * @param string|bool $user_login    Optional. user_login of user being checked.
     200     * @return string The username of the matched user or an empty string if no user is found.
     201     */
     202    function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false ) {
     203        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_slug()' );
     204
     205        if ( ! $user_id ) {
     206            $value = $user_nicename;
     207            $field = 'slug';
     208
     209            if ( ! $user_nicename ) {
     210                $value = $user_login;
     211                $field = 'login';
     212            }
     213
     214            $user = get_user_by( $field, $value );
     215
     216            if ( $user instanceof WP_User ) {
     217                $user_id = (int) $user->ID;
     218            }
     219        }
     220
     221        $username = bp_members_get_user_slug( $user_id );
     222
     223        /**
     224         * Filters the username based on originally provided user ID.
     225         *
     226         * @since 1.0.1
     227         * @deprecated 12.0.0
     228         *
     229         * @param string $username Username determined by user ID.
     230         */
     231        return apply_filters_deprecated( 'bp_core_get_username', array( $username ), '12.0.0', 'bp_members_get_user_slug' );
     232    }
     233
     234    /**
     235     * Return the domain for the passed user: e.g. http://example.com/members/andy/.
     236     *
     237     * @since 1.0.0
     238     * @deprecated 12.0.0
     239     *
     240     * @param int         $user_id       The ID of the user.
     241     * @param string|bool $user_nicename Optional. user_nicename of the user.
     242     * @param string|bool $user_login    Optional. user_login of the user.
     243     * @return string
     244     */
     245    function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) {
     246        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_url()' );
     247
     248        if ( empty( $user_id ) ) {
     249            return;
     250        }
     251
     252        $domain = bp_members_get_user_url( $user_id );
     253
     254        // Don't use this filter.  Subject to removal in a future release.
     255        // Use the 'bp_core_get_user_domain' filter instead.
     256        $domain = apply_filters_deprecated( 'bp_core_get_user_domain_pre_cache', array( $domain, $user_id, $user_nicename, $user_login ), '12.0.0' );
     257
     258        /**
     259         * Filters the domain for the passed user.
     260         *
     261         * @since 1.0.1
     262         * @deprecated 12.0.0
     263         *
     264         * @param string $domain        Domain for the passed user.
     265         * @param int    $user_id       ID of the passed user.
     266         * @param string $user_nicename User nicename of the passed user.
     267         * @param string $user_login    User login of the passed user.
     268         */
     269        return apply_filters_deprecated( 'bp_core_get_user_domain', array( $domain, $user_id, $user_nicename, $user_login ), '12.0.0', 'bp_members_get_user_url' );
     270    }
     271
     272    /**
     273     * Get the link for the logged-in user's profile.
     274     *
     275     * @since 1.0.0
     276     * @deprecated 12.0.0
     277     *
     278     * @return string
     279     */
     280    function bp_get_loggedin_user_link() {
     281        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_loggedin_user_url()' );
     282        $url = bp_loggedin_user_url();
     283
     284        /**
     285         * Filters the link for the logged-in user's profile.
     286         *
     287         * @since 1.2.4
     288         * @deprecated 12.0.0
     289         *
     290         * @param string $url Link for the logged-in user's profile.
     291         */
     292        return apply_filters_deprecated( 'bp_get_loggedin_user_link', array( $url ), '12.0.0', 'bp_loggedin_user_url' );
     293    }
     294
     295    /**
     296     * Get the link for the displayed user's profile.
     297     *
     298     * @since 1.0.0
     299     * @deprecated 12.0.0
     300     *
     301     * @return string
     302     */
     303    function bp_get_displayed_user_link() {
     304        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
     305        $url = bp_displayed_user_url();
     306
     307        /**
     308         * Filters the link for the displayed user's profile.
     309         *
     310         * @since 1.2.4
     311         * @deprecated 12.0.0
     312         *
     313         * @param string $url Link for the displayed user's profile.
     314         */
     315        return apply_filters_deprecated( 'bp_get_displayed_user_link', array( $url ), '12.0.0', 'bp_displayed_user_url' );
     316    }
     317
     318    /**
     319     * Alias of {@link bp_displayed_user_domain()}.
     320     *
     321     * @deprecated 12.0.0
     322     */
     323    function bp_user_link() {
     324        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
     325        bp_displayed_user_url();
     326    }
     327
     328    /**
     329     * Output group directory permalink.
     330     *
     331     * @since 1.5.0
     332     * @deprecated 12.0.0
     333     */
     334    function bp_groups_directory_permalink() {
     335        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_groups_directory_url()' );
     336        bp_groups_directory_url();
     337    }
     338
     339    /**
     340     * Return group directory permalink.
     341     *
     342     * @since 1.5.0
     343     * @deprecated 12.0.0
     344     *
     345     * @return string
     346     */
     347    function bp_get_groups_directory_permalink() {
     348        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_groups_directory_url()' );
     349
     350        $url = bp_get_groups_directory_url();
     351
     352        /**
     353         * Filters the group directory permalink.
     354         *
     355         * @since 1.5.0
     356         * @deprecated 12.0.0
     357         *
     358         * @param string $url Permalink for the group directory.
     359         */
     360        return apply_filters_deprecated( 'bp_get_groups_directory_permalink', array( $url ), '12.0.0', 'bp_get_groups_directory_url' );
     361    }
     362
     363    /**
     364     * Output the permalink for the group.
     365     *
     366     * @since 1.0.0
     367     * @deprecated 12.0.0
     368     *
     369     * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     370     *                                                Default: false.
     371     */
     372    function bp_group_permalink( $group = false ) {
     373        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_url()' );
     374        bp_group_url( $group );
     375    }
     376
     377    /**
     378     * Return the permalink for the group.
     379     *
     380     * @since 1.0.0
     381     * @since 10.0.0 Updated to use `bp_get_group`.
     382     * @deprecated 12.0.0
     383     *
     384     * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     385     *                                                Default: false.
     386     * @return string
     387     */
     388    function bp_get_group_permalink( $group = false ) {
     389        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_group_url()' );
     390        $url = bp_get_group_url( $group );
     391
     392        /**
     393         * Filters the permalink for the group.
     394         *
     395         * @since 1.0.0
     396         * @since 2.5.0 Added the `$group` parameter.
     397         * @deprecated 12.0.0
     398         *
     399         * @param string          $url   Permalink for the group.
     400         * @param BP_Groups_Group $group The group object.
     401         */
     402        return apply_filters_deprecated( 'bp_get_group_permalink', array( $url, $group ), '12.0.0', 'bp_get_group_url' );
     403    }
     404
     405    /**
     406     * Output the permalink for the admin section of the group.
     407     *
     408     * @since 1.0.0
     409     * @deprecated 12.0.0
     410     *
     411     * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     412     *                                                Default: false.
     413     */
     414    function bp_group_admin_permalink( $group = false ) {
     415        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_manage_url()' );
     416        bp_group_manage_url( $group );
     417    }
     418
     419    /**
     420     * Return the permalink for the admin section of the group.
     421     *
     422     * @since 1.0.0
     423     * @since 10.0.0 Updated to use `bp_get_group`.
     424     * @deprecated 12.0.0
     425     *
     426     * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     427     *                                                Default: false.
     428     * @return string
     429     */
     430    function bp_get_group_admin_permalink( $group = false ) {
     431        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_group_manage_url()' );
     432        $permalink = bp_get_group_manage_url( $group );
     433
     434        /**
     435         * Filters the permalink for the admin section of the group.
     436         *
     437         * @since 1.0.0
     438         * @since 2.5.0 Added the `$group` parameter.
     439         * @deprecated 12.0.0
     440         *
     441         * @param string          $permalink Permalink for the admin section of the group.
     442         * @param BP_Groups_Group $group     The group object.
     443         */
     444        return apply_filters_deprecated( 'bp_get_group_admin_permalink', array( $permalink, $group ), '12.0.0', 'bp_get_group_manage_url' );
     445    }
     446
     447    /**
     448     * Output blog directory permalink.
     449     *
     450     * @since 1.5.0
     451     * @deprecated 12.0.0
     452     */
     453    function bp_blogs_directory_permalink() {
     454        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_blogs_directory_url()' );
     455        bp_blogs_directory_url();
     456    }
     457
     458    /**
     459     * Return blog directory permalink.
     460     *
     461     * @since 1.5.0
     462     * @deprecated 12.0.0
     463     *
     464     * @return string The URL of the Blogs directory.
     465     */
     466    function bp_get_blogs_directory_permalink() {
     467        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_blogs_directory_url()' );
     468        $url = bp_get_blogs_directory_url();
     469
     470        /**
     471         * Filters the blog directory permalink.
     472         *
     473         * @since 1.5.0
     474         * @deprecated 12.0.0
     475         *
     476         * @param string $url Permalink URL for the blog directory.
     477         */
     478        return apply_filters_deprecated( 'bp_get_blogs_directory_permalink', array( $url ), '12.0.0', 'bp_get_blogs_directory_url' );
     479    }
    187480}
    188481
     
    243536function bp_core_define_slugs() {
    244537    _deprecated_function( __FUNCTION__, '12.0.0' );
    245 }
    246 
    247 /**
    248  * Return the username for a user based on their user id.
    249  *
    250  * This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE,
    251  * so it will return the user_login or user_nicename as appropriate.
    252  *
    253  * @since 1.0.0
    254  * @deprecated 12.0.0
    255  *
    256  * @param int         $user_id       User ID to check.
    257  * @param string|bool $user_nicename Optional. user_nicename of user being checked.
    258  * @param string|bool $user_login    Optional. user_login of user being checked.
    259  * @return string The username of the matched user or an empty string if no user is found.
    260  */
    261 function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false ) {
    262     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_slug()' );
    263 
    264     if ( ! $user_id ) {
    265         $value = $user_nicename;
    266         $field = 'slug';
    267 
    268         if ( ! $user_nicename ) {
    269             $value = $user_login;
    270             $field = 'login';
    271         }
    272 
    273         $user = get_user_by( $field, $value );
    274 
    275         if ( $user instanceof WP_User ) {
    276             $user_id = (int) $user->ID;
    277         }
    278     }
    279 
    280     $username = bp_members_get_user_slug( $user_id );
    281 
    282     /**
    283      * Filters the username based on originally provided user ID.
    284      *
    285      * @since 1.0.1
    286      * @deprecated 12.0.0
    287      *
    288      * @param string $username Username determined by user ID.
    289      */
    290     return apply_filters_deprecated( 'bp_core_get_username', array( $username ), '12.0.0', 'bp_members_get_user_slug' );
    291 }
    292 
    293 /**
    294  * Return the domain for the passed user: e.g. http://example.com/members/andy/.
    295  *
    296  * @since 1.0.0
    297  * @deprecated 12.0.0
    298  *
    299  * @param int         $user_id       The ID of the user.
    300  * @param string|bool $user_nicename Optional. user_nicename of the user.
    301  * @param string|bool $user_login    Optional. user_login of the user.
    302  * @return string
    303  */
    304 function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) {
    305     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_url()' );
    306 
    307     if ( empty( $user_id ) ) {
    308         return;
    309     }
    310 
    311     $domain = bp_members_get_user_url( $user_id );
    312 
    313     // Don't use this filter.  Subject to removal in a future release.
    314     // Use the 'bp_core_get_user_domain' filter instead.
    315     $domain = apply_filters_deprecated( 'bp_core_get_user_domain_pre_cache', array( $domain, $user_id, $user_nicename, $user_login), '12.0.0' );
    316 
    317     /**
    318      * Filters the domain for the passed user.
    319      *
    320      * @since 1.0.1
    321      * @deprecated 12.0.0
    322      *
    323      * @param string $domain        Domain for the passed user.
    324      * @param int    $user_id       ID of the passed user.
    325      * @param string $user_nicename User nicename of the passed user.
    326      * @param string $user_login    User login of the passed user.
    327      */
    328     return apply_filters_deprecated( 'bp_core_get_user_domain', array( $domain, $user_id, $user_nicename, $user_login), '12.0.0', 'bp_members_get_user_url' );
    329 }
    330 
    331 /**
    332  * Get the link for the logged-in user's profile.
    333  *
    334  * @since 1.0.0
    335  * @deprecated 12.0.0
    336  *
    337  * @return string
    338  */
    339 function bp_get_loggedin_user_link() {
    340     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_loggedin_user_url()' );
    341     $url = bp_loggedin_user_url();
    342 
    343     /**
    344      * Filters the link for the logged-in user's profile.
    345      *
    346      * @since 1.2.4
    347      * @deprecated 12.0.0
    348      *
    349      * @param string $url Link for the logged-in user's profile.
    350      */
    351     return apply_filters_deprecated( 'bp_get_loggedin_user_link', array( $url ), '12.0.0', 'bp_loggedin_user_url' );
    352 }
    353 
    354 /**
    355  * Get the link for the displayed user's profile.
    356  *
    357  * @since 1.0.0
    358  * @deprecated 12.0.0
    359  *
    360  * @return string
    361  */
    362 function bp_get_displayed_user_link() {
    363     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
    364     $url = bp_displayed_user_url();
    365 
    366     /**
    367      * Filters the link for the displayed user's profile.
    368      *
    369      * @since 1.2.4
    370      * @deprecated 12.0.0
    371      *
    372      * @param string $url Link for the displayed user's profile.
    373      */
    374     return apply_filters_deprecated( 'bp_get_displayed_user_link', array( $url ), '12.0.0', 'bp_displayed_user_url' );
    375 }
    376 
    377 /**
    378  * Alias of {@link bp_displayed_user_domain()}.
    379  *
    380  * @deprecated 12.0.0
    381  */
    382 function bp_user_link() {
    383     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
    384     bp_displayed_user_url();
    385 }
    386 
    387 /**
    388  * Output group directory permalink.
    389  *
    390  * @since 1.5.0
    391  * @deprecated 12.0.0
    392  */
    393 function bp_groups_directory_permalink() {
    394     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_groups_directory_url()' );
    395     bp_groups_directory_url();
    396 }
    397 
    398 /**
    399  * Return group directory permalink.
    400  *
    401  * @since 1.5.0
    402  * @deprecated 12.0.0
    403  *
    404  * @return string
    405  */
    406 function bp_get_groups_directory_permalink() {
    407     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_groups_directory_url()' );
    408 
    409     $url = bp_get_groups_directory_url();
    410 
    411     /**
    412      * Filters the group directory permalink.
    413      *
    414      * @since 1.5.0
    415      * @deprecated 12.0.0
    416      *
    417      * @param string $url Permalink for the group directory.
    418      */
    419     return apply_filters_deprecated( 'bp_get_groups_directory_permalink', array( $url ), '12.0.0', 'bp_get_groups_directory_url' );
    420 }
    421 
    422 /**
    423  * Output the permalink for the group.
    424  *
    425  * @since 1.0.0
    426  * @deprecated 12.0.0
    427  *
    428  * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    429  *                                                Default: false.
    430  */
    431 function bp_group_permalink( $group = false ) {
    432     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_url' );
    433     bp_group_url( $group );
    434 }
    435 /**
    436  * Return the permalink for the group.
    437  *
    438  * @since 1.0.0
    439  * @since 10.0.0 Updated to use `bp_get_group`.
    440  * @deprecated 12.0.0
    441  *
    442  * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    443  *                                                Default: false.
    444  * @return string
    445  */
    446 function bp_get_group_permalink( $group = false ) {
    447     $url = bp_get_group_url( $group );
    448 
    449     /**
    450      * Filters the permalink for the group.
    451      *
    452      * @since 1.0.0
    453      * @since 2.5.0 Added the `$group` parameter.
    454      * @deprecated 12.0.0
    455      *
    456      * @param string          $url   Permalink for the group.
    457      * @param BP_Groups_Group $group The group object.
    458      */
    459     return apply_filters_deprecated( 'bp_get_group_permalink', array( $url, $group ), '12.0.0', 'bp_get_group_url' );
    460 }
    461 
    462 /**
    463  * Output the permalink for the admin section of the group.
    464  *
    465  * @since 1.0.0
    466  * @deprecated 12.0.0
    467  *
    468  * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    469  *                                                Default: false.
    470  */
    471 function bp_group_admin_permalink( $group = false ) {
    472     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_manage_url' );
    473     bp_group_manage_url( $group );
    474 }
    475 
    476 /**
    477  * Return the permalink for the admin section of the group.
    478  *
    479  * @since 1.0.0
    480  * @since 10.0.0 Updated to use `bp_get_group`.
    481  * @deprecated 12.0.0
    482  *
    483  * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    484  *                                                Default: false.
    485  * @return string
    486  */
    487 function bp_get_group_admin_permalink( $group = false ) {
    488     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_group_manage_url' );
    489     $permalink = bp_get_group_manage_url( $group );
    490 
    491     /**
    492      * Filters the permalink for the admin section of the group.
    493      *
    494      * @since 1.0.0
    495      * @since 2.5.0 Added the `$group` parameter.
    496      * @deprecated 12.0.0
    497      *
    498      * @param string          $permalink Permalink for the admin section of the group.
    499      * @param BP_Groups_Group $group     The group object.
    500      */
    501     return apply_filters_deprecated( 'bp_get_group_admin_permalink', array( $permalink, $group ), '12.0.0', 'bp_get_group_manage_url' );
    502 }
    503 
    504 /**
    505  * Output blog directory permalink.
    506  *
    507  * @since 1.5.0
    508  * @deprecated 12.0.0
    509  */
    510 function bp_blogs_directory_permalink() {
    511     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_blogs_directory_url()' );
    512     bp_blogs_directory_url();
    513 }
    514 
    515 /**
    516  * Return blog directory permalink.
    517  *
    518  * @since 1.5.0
    519  * @deprecated 12.0.0
    520  *
    521  * @return string The URL of the Blogs directory.
    522  */
    523 function bp_get_blogs_directory_permalink() {
    524     _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_blogs_directory_url()' );
    525     $url = bp_get_blogs_directory_url();
    526 
    527     /**
    528      * Filters the blog directory permalink.
    529      *
    530      * @since 1.5.0
    531      * @deprecated 12.0.0
    532      *
    533      * @param string $url Permalink URL for the blog directory.
    534      */
    535     return apply_filters_deprecated( 'bp_get_blogs_directory_permalink', array( $url ), '12.0.0', 'bp_get_blogs_directory_url' );
    536538}
    537539
     
    583585 */
    584586function bp_blogs_blog_tabs() {
     587    _deprecated_function( __FUNCTION__, '12.0.0' );
    585588
    586589    // Don't show these tabs on a user's own profile.
     
    637640 */
    638641function bp_admin_display_directory_states( $post_states = array(), $post = null ) {
     642    _deprecated_function( __FUNCTION__, '12.0.0' );
    639643    $states = array();
    640644
Note: See TracChangeset for help on using the changeset viewer.