• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Allow a WordPress user role to read Gravity Forms entries

Discover in this tutorial how to give the ability to view Gravity Forms posts to a custom WordPress user role via code, without plugins.

By default, WordPress has 5 user roles:

  • Subscriber > ( 'subscriber' )
  • Contributor > ( 'contributor' )
  • Author > ( 'author' )
  • Editor > ( 'editor' )
  • Administrator > ( 'administrator' )

In addition to those, some plugins can add new roles. For example, WooCommerce creates two more:

  • Customer
  • Store manager

In fact, in a previous tutorial you learned how to create a new user role with the capabilities you want.

In this case, I’m going to tell you how you can extend the capabilities of the user role of your choice so that it can access Gravity Forms form entries. Something very practical, for example, if you want to give access to a virtual assistant.

Let’s see how to do it:

Snippet to allow a user role to read Gravity Forms entries

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 883 code snippets of this website, login or subscribe here.

With this snippet you first get the role 'asistant' and then add the ability to view entries with the add_cap() function.

This is just an example, where you allow the person(s) who have the asistant role to have access to review Gravity Forms entries. But the idea is that you assign it to the user role that interests you.

By the way, the new capability is saved in the database so once you have refreshed the page, which will make the code to run, you can delete the snippet.

Conclusion

Now you know how to allow a WordPress user role to view submissions received on Gravity Forms, with a simple code snippet.

Any questions? I read you in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

Gravity Forms PHP WordPress

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?