BP_REST_Signup_Endpoint::delete_item( WP_REST_Request $request )
Delete a signup.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response) | WP_Error
Source
File: bp-members/classes/class-bp-rest-signup-endpoint.php
930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | public function delete_item( $request ) { $request ->set_param( 'context' , 'edit' ); // Get the signup before it's deleted. $signup = $this ->get_signup_object( $request [ 'id' ] ); $previous = $this ->prepare_item_for_response( $signup , $request ); $deleted = BP_Signup:: delete ( array ( $signup ->id ) ); if ( ! $deleted ) { return new WP_Error( 'bp_rest_signup_cannot_delete' , __( 'Could not delete signup.' , 'buddyboss' ), array ( 'status' => 500, ) ); } // Build the response. $response = new WP_REST_Response(); $response ->set_data( array ( 'deleted' => true, 'previous' => $previous ->get_data(), ) ); /** * Fires after a signup is deleted via the REST API. * * @param BP_Signup $signup The deleted signup. * @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_signup_delete_item' , $signup , $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.