Skip to content

Instantly share code, notes, and snippets.

@roytanck
Last active December 14, 2015 15:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roytanck/5108181 to your computer and use it in GitHub Desktop.
Save roytanck/5108181 to your computer and use it in GitHub Desktop.
Remove gravity forms capabilities for non-admin users, through Gravity Form's 'gform_cap_full_access' hook.
if( ! function_exists( 'rt_filter_gform_caps' ) ) {
function rt_filter_gform_caps( $caps ){
if( !current_user_can( 'manage_options' ) ){
if( current_user_can( 'gform_full_access' ) ){
$user = wp_get_current_user();
$user->remove_cap('gform_full_access');
}
return '';
} else {
return $caps;
}
}
}
add_filter( "gform_cap_full_access", "rt_filter_gform_caps" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment