The gform_web_api_capability_put_entries_properties Gravity Forms PHP filter allows you to modify the capability required to update entry properties via the web API.
Usage
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { // your custom code here return $capability; });
Parameters
- $capability (string): The capability required. Defaults to ‘gravityforms_edit_entries’.
More information
See Gravity Forms Docs: gform_web_api_capability_put_entries_properties
Examples
Change the required capability
This example changes the required capability to update entry properties via the web API to ‘manage_options’.
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { return 'manage_options'; });
Grant capability to a specific user role
This example grants the ‘editor’ role the capability to update entry properties via the web API.
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { $role = get_role('editor'); $role->add_cap('gravityforms_edit_entries'); return $capability; });
Grant capability based on a custom user meta
This example grants the capability to update entry properties via the web API for users with ‘can_edit_entries’ set to true in their user meta.
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { $user_id = get_current_user_id(); $can_edit_entries = get_user_meta($user_id, 'can_edit_entries', true); if ($can_edit_entries) { return $capability; } return 'do_not_allow'; });
Remove the capability
This example removes the capability to update entry properties via the web API for all users.
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { return 'do_not_allow'; });
Check custom condition for capability
This example checks a custom condition (e.g., current user has a specific email domain) before granting the capability to update entry properties via the web API.
add_filter('gform_web_api_capability_put_entries_properties', function($capability) { $user = wp_get_current_user(); $email_domain = substr(strrchr($user->user_email, "@"), 1); if ($email_domain == 'example.com') { return $capability; } return 'do_not_allow'; });