Skip to:
Content

BuddyPress.org

Ticket #8490: 8490.diff

File 8490.diff, 978 bytes (added by espellcaste, 5 years ago)
  • src/bp-core/bp-core-rest-api.php

    diff --git a/src/bp-core/bp-core-rest-api.php b/src/bp-core/bp-core-rest-api.php
    index 40771ef34..0d0fbfa7a 100644
    a b function bp_rest_version() { 
    138138 * Get user URL.
    139139 *
    140140 * @since 5.0.0
     141 * @deprecated 9.0.0 Use `bp_rest_get_object_url` instead.
    141142 *
    142143 * @param  int $user_id User ID.
    143144 * @return string
    function bp_rest_get_user_url( $user_id ) { 
    151152        );
    152153}
    153154
     155/**
     156 * Get a REST API object URL from a component.
     157 *
     158 * @since 9.0.0
     159 *
     160 * @param integer $object_id   Object ID.
     161 * @param string  $object_path Path of the component endpoint.
     162 * @return string
     163 */
     164function bp_rest_get_object_url( $object_id, $object_path ) {
     165        return rest_url(
     166                sprintf(
     167                        '/%1$s/%2$s/%3$s/%4$d',
     168                        bp_rest_namespace(),
     169                        bp_rest_version(),
     170                        $object_path,
     171                        $object_id
     172                )
     173        );
     174}
     175
    154176/**
    155177 * Set headers to let the Client Script be aware of the pagination.
    156178 *