Last active
December 14, 2015 15:29
-
-
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.
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
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