Gravity forms access for editors

Gravity Forms is an excellent WordPress plugin, which allows flexible and easy control and creation of pretty much any kind of form in your website. Behind the scenes it has a very flexible integration with the WordPress system of roles and capabilities, which governs who can do what in your admin area. The code below can be cut and pasted into a small plugin or, easier, your functions.php to allow your editor role users to do everything with your forms, except for updating the plugin, installing add-ons and uninstalling. (You can probably work out which lines to remove to tailor this to your current situation, and if you give too many capabilities you can change add_cap to remove_cap to remove the capability from the editor role.) Once the new rules have taken effect you can delete the code and the effects will remain!

$editor = get_role( 'editor' );
$editor->add_cap( 'gravityforms_edit_forms' );
$editor->add_cap( 'gravityforms_delete_forms' );
$editor->add_cap( 'gravityforms_create_form' );
$editor->add_cap( 'gravityforms_view_entries' );
$editor->add_cap( 'gravityforms_edit_entries' );
$editor->add_cap( 'gravityforms_delete_entries' );
$editor->add_cap( 'gravityforms_view_settings' );
$editor->add_cap( 'gravityforms_edit_settings' );
$editor->add_cap( 'gravityforms_export_entries' );
$editor->add_cap( 'gravityforms_view_entry_notes' );
$editor->add_cap( 'gravityforms_edit_entry_notes' );

Join the Conversation

4 Comments

  1. Super useful!
    Would you be able to help me with a snippet of code where I could use the add_cap for a specific form, to a specific user (or better yet a vendor)?

    I am using GF and a woothemes vendor plugin which allows people to associate products to users (Vendors) and would like to be able to allow these vendors to export their entries from the GF I create specifically for them?
    I could also add them to a new group I guess, which would sort out half the problem ie vendor1 = group1 vendor = group2 but how would I limit them to the specific forms rather than being able to export all the forms?

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.