PDF for GravityView Hooks – gfpdf_gv_bulk_export_capability
Description
Use this filter to change the capability required to use the Download PDFs bulk action. The action generates a Single Entry PDF for each selected entry and returns them in one ZIP file.
The default capability is gravityview_edit_entries, the same one GravityView's front-end entry export uses. In a default install, Authors, Editors and Administrators have it. The capability is checked when the action is shown and again when it runs.
Bulk exports are never refused by the render budget. This capability is the only limit on how many PDFs a user can generate this way. Don't lower it to a capability held by Subscribers or every logged-in user.
See Download PDFs. Related hooks: gfpdf_gv_bulk_export_filename and gfpdf_gv_bulk_export_ttl.
Version
This hook was introduced in PDF for GravityView 2.0.
Arguments
The following arguments are passed to functions that use this hook:
$capability | string
- The capability a user needs to see and run the Download PDFs bulk action.
- The default value is
gravityview_edit_entries.
Usage
Only allow users who can edit other people's entries (Editors and Administrators, by default):
add_filter( 'gfpdf_gv_bulk_export_capability', function( $capability ) {
return 'gravityview_edit_others_entries';
} );
Only allow Administrators:
add_filter( 'gfpdf_gv_bulk_export_capability', function( $capability ) {
return 'manage_options';
} );
Source Code
This filter is located in src/GravityView/BulkExport.php of the PDF for GravityView extension.