GravityView capabilities
Note: A custom role needs no GravityView or Gravity Forms capabilities for its users to edit their own entries. Turn on Allow User Edit in the View’s settings, and logged-in users can edit the entries they created.
GravityView capabilities #
You can control who has each GravityView capability. We recommend managing them with the Members plugin.
GravityView’s capabilities are standard WordPress capabilities. To take one away from a built-in role (Administrator, Editor, Author, Contributor, or Subscriber), deny it, for example with the capability’s Deny checkbox in Members. GravityView adds back any default capability that is missing from these roles each time an admin page loads, so a capability that is only removed comes back. The free User Role Editor plugin can remove a capability from a role but can’t deny it.
Full access
gravityview_full_access: Controls whether the user has access to all GravityView capabilities. Enabling this capability is the same as allowing all of the others.
Settings
gravityview_view_settings: Controls whether plugin settings can be viewed.gravityview_edit_settings: Controls whether plugin settings can be modified.gravityview_uninstall: GravityView registers this capability but doesn’t use it.gravityview_getting_started: Controls whether the user can read the GravityView Getting Started page.
Entry capabilities
gravityview_moderate_entries: Controls whether entries can be approved or rejected. If disabled, hides the Approval column in the Entries screen and the “Approve” and “Disapprove” Bulk Edit actions. Required to moderate entries from the front end.gravityview_edit_others_entries: Controls whether the user can edit others’ entries in the GravityView Edit Entry screen.gravityview_delete_others_entries: Controls whether the user can delete others’ entries in the GravityView Edit Entry screen.gravityview_edit_entries: Controls whether the user can use the “Change Entry Creator” functionality or see Edit Entry in the Admin Toolbar.
Entry notes capabilities
gravityview_add_entry_notes: Controls whether entry notes can be added from the front end.gravityview_view_entry_notes: Controls whether entry notes can be viewed from the front end.gravityview_delete_entry_notes: Controls whether entry notes can be deleted from the front end.gravityview_email_entry_notes: Controls whether the user can also send an email (to an email address connected to an entry) while adding a note.
View capabilities
edit_gravityviews: Controls whether Views can be edited. If disabled, the “Views” menu item is not visible.edit_others_gravityviews: Controls whether Views owned by other users can be edited.publish_gravityviews: Controls whether Views can be published.read_private_gravityviews: Controls whether private Views can be read.delete_gravityviews: Controls whether Views of this post type can be deleted.delete_private_gravityviews: Controls whether private Views can be deleted.delete_published_gravityviews: Controls whether published Views can be deleted.delete_others_gravityviews: Controls whether Views owned by other users can be deleted, and whether the Delete Views section shows in GravityKit, then Settings, then GravityView.edit_private_gravityviews: Controls whether private Views can be edited.edit_published_gravityviews: Controls whether published Views can be edited.copy_gravityviews: Controls whether the Clone and New Draft links show in the Views list.
Support capabilities
gravityview_contact_support: Controls whether the user can contact GravityKit’s support through the Support Port.gravityview_support_port: Controls whether the GravityView Support Port is visible.
Per-View capabilities
These are meta capabilities: each one represents an action against a single View rather than something you assign to a role. They will not appear in a role editor such as Members, and adding them to a role has no effect. WordPress resolves them into the primitive capabilities listed under View capabilities above, based on who authored the View.
edit_gravityview: Controls whether a specific View can be edited.read_gravityview: Controls whether a specific View can be read.delete_gravityview: Controls whether a specific View can be deleted.
Letting a role edit only one View
The primitive capabilities apply to the whole post type, so edit_others_gravityviews grants editing on every View at once. The one per-View distinction WordPress makes on its own is authorship, which separates editing your own Views from editing everyone else’s. Both approaches below build on that.
Warning: since GravityView 3.0, a user without the unfiltered_html capability cannot edit Views at all, regardless of which View capabilities they have been given. The built-in Editor role has unfiltered_html, but a custom role built up from Subscriber does not. On a multisite network the capability is reserved for Super Admins.
Option 1: make the user the View’s author. Give the role edit_gravityviews, edit_published_gravityviews and unfiltered_html, and leave edit_others_gravityviews switched off. That user can then edit any View they authored, and no others. Views do not show an Author field in the editor by default, so add one:
add_filter( 'gravityview_post_type_support', function ( $supports ) {
$supports[] = 'author';
return $supports;
} );Option 2: grant one specific View. To tie the permission to a single View no matter who authored it, filter user_has_cap and grant the primitive capabilities only for that one pairing of user and View. Replace 45 with the user ID and 123 with the View ID:
/**
* Allows one user to edit one specific View.
*
* The per-View meta capability (edit_gravityview) is resolved by WordPress into the
* primitive capabilities granted below, so those are what need to be set.
*
* @param array $caps All capabilities the user currently has.
* @param array $required The capabilities required for this check.
* @param array $args [0] requested capability, [1] user ID, [2] object ID.
*
* @return array
*/
add_filter( 'user_has_cap', function ( $caps, $required, $args ) {
$user_id = 45; // The user who should get access.
$view_id = 123; // The View they should be able to edit.
// Only act on an edit check against a specific post.
if ( 'edit_post' !== ( $args[0] ?? '' ) ) {
return $caps;
}
// Bail unless this is the exact user and View pairing.
if ( (int) ( $args[1] ?? 0 ) !== $user_id || (int) ( $args[2] ?? 0 ) !== $view_id ) {
return $caps;
}
$caps['edit_others_gravityviews'] = true;
$caps['edit_published_gravityviews'] = true;
return $caps;
}, 10, 3 );Note: Where to put code samples explains how to add these snippets to your site.
Roles #
GravityView adds the following capabilities to each role whenever they are missing:
Administrator
Administrators get these capabilities and those of the roles below.
gravityview_full_accessgravityview_view_settingsgravityview_edit_settingsgravityview_uninstallgravityview_contact_supportedit_others_gravityviewsedit_private_gravityviewsedit_published_gravityviews
Editor
Editors get these capabilities and those of the roles below.
read_private_gravityviewsdelete_private_gravityviewsdelete_others_gravityviewspublish_gravityviewsdelete_published_gravityviewscopy_gravityviewsgravityview_edit_others_entriesgravityview_moderate_entriesgravityview_delete_others_entriesgravityview_add_entry_notesgravityview_view_entry_notesgravityview_delete_entry_notesgravityview_email_entry_notes
Author
Authors get these capabilities and those of the roles below.
gravityview_edit_entriesgravityview_edit_entrygravityview_edit_form_entriesgravityview_delete_entriesgravityview_delete_entry
Contributor
Contributors get these capabilities and those of the roles below.
edit_gravityviewsdelete_gravityviewsgravityview_getting_startedgravityview_support_port
Subscriber
Subscribers get these capabilities:
gravityview_view_entriesgravityview_view_others_entriesread: If your Views don’t show for a Subscriber, check that the role has this WordPress capability.