gravityflow_rest_api_capability_get_forms_steps

Description

The gravityflow_rest_api_capability_get_forms_steps filter allows customization of the capabilities an authenticated request must have to access any of the following endpoints:

Parameters

ParameterTypeDetails
$capabilityStringRequired capability (or capabilities) checked via current_user_can to determine if the current user can view entry assignees. Default is gravityflow_create_steps.
$requestWP_REST_RequestThe REST request object.

A request that is unsuccessful based on the permissions check following this filter will return a WP_Error with:

HTTP Status CodeError CodeError MessageDetails
401 (Unauthorized)gravityflow_rest_cannot_get_stepsSorry, you are not allowed to get steps for this form.The user is not logged in.
403 (Forbidden)gravityflow_rest_cannot_get_stepsSorry, you are not allowed to get steps for this form.The user is logged in but doesn’t have permission.

Examples

Check a different capability

This example will lead to the request permissions check being performed against a different Gravity Flow capability

add_filter( 'gravityflow_rest_api_capability_get_forms_steps', 'flow_capability_form_steps_type', 10, 2 );
function flow_capability_form_steps_type( $capability, $request ) {
	$capability = 'gravityflow_settings';     
	return $capability;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This endpoint was added in Gravity Flow 3.0.

Source Code

This endpoint is located in the gravityflow/includes/rest-api/v2/controllers/class-controller-steps.php file.