Using Gravity Forms ‘gform_webapi_key_user_capabilities’ PHP filter

The gform_webapi_key_user_capabilities filter allows you to override the list of capabilities used to determine if a user is included in the User drop-down menu when creating a new REST API Key in Gravity Forms.

Usage

To use the filter, add the following code:

add_filter('gform_webapi_key_user_capabilities', 'your_function_name');

Parameters

  • $capabilities (array): A list of Gravity Forms capabilities used by REST API endpoints.

More information

See Gravity Forms Docs: gform_webapi_key_user_capabilities

This filter was added in Gravity Forms v2.4.23.2.

Source code location: GFWebAPI::user_can_access_api() in includes/webapi/webapi.php.

Examples

Add Custom Capability

This example adds a custom capability, ‘create_users’, to the list.

add_filter('gform_webapi_key_user_capabilities', function($capabilities) {
    $capabilities[] = 'create_users';
    return $capabilities;
});