Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/04/2023 01:06:03 AM (14 months ago)
Author:
imath
Message:

Use the BP Rewrites API to generate single Groups item links

  • Introduce the bp_groups_get_path_chunks() function to build BP Rewrites arguments using a regular array.
  • Improve bp_members_get_path_chunks() so that it avoids looking for a custom slug when the chunk is a numeric value.
  • Introduce the bp_get_group_manage_url() function to build Group's front-end Admin URLs using BP Rewrites.
  • Deprecate bp_group_admin_permalink() & bp_get_group_admin_permalink() in favor of bp_group_manage_url() & bp_get_group_manage_url().
  • Replace all remaining usage of bp_get_group_permalink() in favor of bp_get_group_url() or bp_get_group_manage_url().

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/81
See #4954

File:
1 edited

Legend:

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

    r13443 r13446  
    297297    _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
    298298    bp_displayed_user_url();
     299}
     300
     301/**
     302 * Output the permalink for the group.
     303 *
     304 * @since 1.0.0
     305 * @deprecated 12.0.0
     306 *
     307 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     308 *                                                Default: false.
     309 */
     310function bp_group_permalink( $group = false ) {
     311    _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_url' );
     312    bp_group_url( $group );
     313}
     314/**
     315 * Return the permalink for the group.
     316 *
     317 * @since 1.0.0
     318 * @since 10.0.0 Updated to use `bp_get_group`.
     319 * @deprecated 12.0.0
     320 *
     321 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     322 *                                                Default: false.
     323 * @return string
     324 */
     325function bp_get_group_permalink( $group = false ) {
     326    $url = bp_get_group_url( $group );
     327
     328    /**
     329     * Filters the permalink for the group.
     330     *
     331     * @since 1.0.0
     332     * @since 2.5.0 Added the `$group` parameter.
     333     * @deprecated 12.0.0
     334     *
     335     * @param string          $url   Permalink for the group.
     336     * @param BP_Groups_Group $group The group object.
     337     */
     338    return apply_filters_deprecated( 'bp_get_group_permalink', array( $url, $group ), '12.0.0', 'bp_get_group_url' );
     339}
     340
     341/**
     342 * Output the permalink for the admin section of the group.
     343 *
     344 * @since 1.0.0
     345 * @deprecated 12.0.0
     346 *
     347 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     348 *                                                Default: false.
     349 */
     350function bp_group_admin_permalink( $group = false ) {
     351    _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_manage_url' );
     352    bp_group_manage_url( $group );
     353}
     354
     355/**
     356 * Return the permalink for the admin section of the group.
     357 *
     358 * @since 1.0.0
     359 * @since 10.0.0 Updated to use `bp_get_group`.
     360 * @deprecated 12.0.0
     361 *
     362 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     363 *                                                Default: false.
     364 * @return string
     365 */
     366function bp_get_group_admin_permalink( $group = false ) {
     367    _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_group_manage_url' );
     368    $permalink = bp_get_group_manage_url( $group );
     369
     370    /**
     371     * Filters the permalink for the admin section of the group.
     372     *
     373     * @since 1.0.0
     374     * @since 2.5.0 Added the `$group` parameter.
     375     * @deprecated 12.0.0
     376     *
     377     * @param string          $permalink Permalink for the admin section of the group.
     378     * @param BP_Groups_Group $group     The group object.
     379     */
     380    return apply_filters_deprecated( 'bp_get_group_admin_permalink', array( $permalink, $group ), '12.0.0', 'bp_get_group_manage_url' );
    299381}
    300382
Note: See TracChangeset for help on using the changeset viewer.