AI Verified

Name

Access to Gravity Forms

About

<p>This code snippet allows specific WordPress roles to have full access to Gravity Forms within the admin dashboard. By default, this snippet grants this access to the Editor role.</p> <p>If you want to extend this access to other roles, you can easily do so by duplicating the lines inside the function and replacing <code>'editor'</code> with the role you want to grant access to (e.g., <code>'author'</code>, <code>'contributor'</code>, etc.). Then uncomment the lines and save your changes.</p> <p>The function hooks into the <code>admin_init</code> action to update these capabilities when the admin area is accessed.<br />Updated 30 Oct 2023</p>

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

lowthian

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://www.lowthiandesign.com

History

Last modified:

21/05/2024

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Access to Gravity Forms

 
                    
1/**
2 * Grant Gravity Forms full access to specific roles.
3 * To extend access to other roles, simply copy the lines inside the function and replace 'editor' with the desired role.
4 */
5function add_gravity_forms_access_to_roles() {
6 // Grant access to the Editor role
7 $editor_role = get_role('editor');
8 if ($editor_role) {
9 $editor_role->add_cap('gform_full_access');
10 }
11 
12 // To grant access to other roles, add similar blocks here.
13 // Example for the 'author' role:
14 // $author_role = get_role('author');
15 // if ($author_role) {
16 // $author_role->add_cap('gform_full_access');
17 // }
18}
19 
20// Hook into the 'admin_init' action to apply these capabilities
21add_action('admin_init', 'add_gravity_forms_access_to_roles');

0

Related Snippets

Please see some snippets below related to this snippet..

General

AI Verified

0

Change post name in dashboard

Added: 6 months ago

Last Updated: 5 months ago

General

AI Verified

0

Classic Editor - Move featured Image

Added: 1 month ago

Last Updated: 2 weeks ago

General

Unverified

0

GA 4 - Header

Added: 11 months ago

Last Updated: 11 months ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

View update info on posts

Added: 3 weeks ago

Last Updated: 3 weeks ago

WordPress Admin

AI Verified

1

Link to clear Bunny CDN

Added: 4 months ago

Last Updated: 4 months ago

I wanted a way for my clients to have a one click "Clear Bunny CDN" without having to go into other settings. Worked with AI and BunnyCDN support on this.

General

AI Verified

0

Gravity to Stripe Description

Added: 8 months ago

Last Updated: 8 months ago