Description
The gform_webapi_key_user_capabilities filter allows the list of capabilities which are used to determine if a user is included in the User drop down menu when creating a new REST API Key to be overridden.
Usage
The filter would be used like so:
add_filter( 'gform_webapi_key_user_capabilities', 'your_function_name' );
Parameters
- $capabilities array
A list of Gravity Forms capabilities used by REST API endpoints.
Examples
1. Add Capability
This example adds a new capability to the list.
add_filter( 'gform_webapi_key_user_capabilities', function ( $capabilities ) { $capabilities[] = 'create_users'; return $capabilities; } );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.4.23.2.
Source Code
This filter is located in GFWebAPI::user_can_access_api() in includes/webapi/webapi.php.