BP_REST_Attachments_Group_Cover_Endpoint::get_item( WP_REST_Request $request )
Fetch an existing group cover.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response) | WP_Error
Source
File: bp-groups/classes/class-bp-rest-attachments-group-cover-endpoint.php
public function get_item( $request ) { $cover_url = bp_get_group_cover_url( $this->group ); if ( empty( $cover_url ) ) { return new WP_Error( 'bp_rest_attachments_group_cover_no_image', __( 'Sorry, there was a problem fetching this group cover.', 'buddyboss' ), array( 'status' => 500, ) ); } $retval = $this->prepare_response_for_collection( $this->prepare_item_for_response( $cover_url, $request ) ); $response = rest_ensure_response( $retval ); /** * Fires after a group cover is fetched via the REST API. * * @param string $cover_url The group cover url. * @param WP_REST_Response $response The response data. * @param WP_REST_Request $request The request sent to the API. * * @since 0.1.0 */ do_action( 'bp_rest_attachments_group_cover_get_item', $cover_url, $response, $request ); return $response; }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.