Last active
September 11, 2018 16:59
-
-
Save landbryo/291584ce8608e65ccba2406b0ba0e85d to your computer and use it in GitHub Desktop.
Grant editor role full access to Gravity Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* These functions are set to run on init and can be removed after they've run once. There is no need to keep them in the functions file */ | |
/* Credit goes to https://ryanbenhase.com/giving-editors-access-to-gravity-forms/ */ | |
////////////////// | |
// GRANT ACCESS // | |
////////////////// | |
function grant_gforms_editor_access() { | |
$role = get_role( 'editor' ); | |
$role->add_cap( 'gform_full_access' ); | |
} | |
add_action( 'init', 'grant_gforms_editor_access' ); | |
/////////////////// | |
// REVOKE ACCESS // | |
/////////////////// | |
function revoke_gforms_editor_access() { | |
$role = get_role( 'editor' ); | |
$role->remove_cap( 'gform_full_access' ); | |
} | |
add_action( 'init', 'revoke_gforms_editor_access' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment