Enable role to access the Gravity Forms admin screen

Image of an astronaut sitting in a room.

Gravity Forms is in my opinion the best choice if you’re looking for a form plugin. Unfortunately by default only users with the Administrator role can access the Gravity Forms admin screen. If you want other roles being able to create forms, view entries, etc. simply use the following code.

function add_gf_cap()
{
$role = get_role( 'editor' );
$role->add_cap( 'gform_full_access' );
}

add_action( 'admin_init', 'add_gf_cap' );

I’ve used the Editor role, but you can change this to any role you want of course.

Important: Adding an extra capability to a role is saved in the database, meaning it should only run once. Best implementation is to run ‘add_gf_cap’ in theme/plugin activation. The code above does not do this but runs it on ‘admin_init’ instead. Be sure to remove the add_action (or the complete code) after it ran. More information about adding capabilities can be found here.

Related Posts

Powered By Related Posts for WordPress
Click Here to Learn More About Related Posts for WordPress

9 thoughts on “Enable role to access the Gravity Forms admin screen

  1. Hi Barry,

    This works! However, can you tell me how I should go about letting editors only have access to view existing forms and form entries.
    I dont want them to create new forms and change settings.

    Many thanks
    Schalk

  2. Hi Barry!

    It definitely works, thnx!

    I would also be interested to give editors access to form entries only instead of full access. Gravity Forms advises using the Members plugin for role management, do you agree?

    Regards,
    Martijn

  3. Not only do they recommend the Members plug-in but their offer up a list of capabilities you can control that’s pretty granular: http://www.gravityhelp.com/documentation/page/Role_Management

  4. Hello.
    Would it be possible to add some code to snippet to limit access to one or two gravity forms?

    Eg. Give access to form (id) 3 and 4 to a certain role

  5. Poornimapriya

    This is not even working for me. I am getting whole bunch of errors. Editor role is getting menu links in admin menu side bar but its available in admin role. Help me with the same

  6. After leaving your following codes in my themes/./functtions.php:
    —————————————————–
    function add_gf_cap()
    {
    $role = get_role( ‘editor’ );
    $role->add_cap( ‘gform_full_access’ );
    }
    add_action( ‘admin_init’, ‘add_gf_cap’ );
    ———————————————————–
    I ‘m supposed to see the Gravity Forms admin screen displaying on my editor profile, but I can’t ! Any idea to help ?

  7. Thank you, I learned the fact that it should only run once from your article. Creating a small plugin for this is the best way, I think.

Leave a Reply

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