We’ve been testing Gravity Forms here as part of our WordPress CMS, allowing users easy access to be able to make forms and manage them right inside WordPress. So far, our tests have been positive, and we’re set to open it up to all our users.
We’ve run into a challenge though as we get ready to roll this out. When set up and turned on in one of our sites (we run multi-site), only administrative users could access and see Gravity Forms.
We set up our campus users as editors, so they can’t go and switch themes and install rogue plugins. Even though the plugin was installed, editors couldn’t see Gravity Forms. They could see all our other functions and custom post types, but not Gravity Forms.
I wrote to their support, who suggested I use yet another plugin. That’s fine if I was just running one site, but at 140 sites and growing, I can’t be spending all day in that plugin turning things on and off. I figured there’d have to be a way to give the editor role access.
Enter some code. It’s one of the things that I really love about WordPress. With a bit of good code, you can do a lot of different things.
I added the following to my functions.php file, making Gravity Forms see that the user role of editor had the correct privileges and could run it. After some trial and error, I found the following snippet of code worked for an editor:
function add_grav_forms(){ $role = get_role('editor'); $role->add_cap('gform_full_access'); } add_action('admin_init','add_grav_forms');
So far, so good. I can make new forms, see entries and more as an editor, and I think I won’t have to manage this with a plugin, which is good to avoid that overhead where possible. Here’s what an editor sees now. The other things (taters, tots, etc) are custom post types we’ve developed.
very nice and well explained tutor
Hey thanks. Just what I was looking for.
Works perfectly, though I did need to logout and log in again on my editor user account in order to see the changes take effect.
Thanks so much
Excellent, glad to hear.
thanks for sharing, that’s one of the other beauties of WP
Good stuff! it worked perfectly! Thanks
Thanks for sharing – worked w/o any issues. This should really be an option that an admin can control via the Gravity settings page.
I know this is an old post but this still works like a charm. Thank you for sharing!