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.
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
You might want to check out the Members plugins that Martijn suggested below.
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
Hey Martijn,
I’ve never personally used the Members plugin but I’ve heard good things about it. Good luck!
Barry
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
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
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
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 ?
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.