Change WordPress user roles and capabilities Forums Bug Reports Cannot disable gravity forms for administrators Reply To: Cannot disable gravity forms for administrators

#433
Vladimir
Keymaster

Hi Joe,

If user with ‘administrator’ role has no any GF capabilities he automatically get full access to GF plugin functionality, line #841 of gravityforms.php file:

        else if(current_user_can("administrator")|| is_super_admin()){

            //checking if user has any GF permission.
            $has_gf_cap = false;
            foreach($gf_caps as $gf_cap){
                if(rgar($all_caps, $gf_cap))
                    $has_gf_cap = true;
            }

            if(!$has_gf_cap){
                //give full access to administrators if none of the GF permissions are active by the Members plugin
                $all_caps["gform_full_access"] = true;
            }
        }

Try to leave at least one minimal capability, e.g. “gravityforms_view_entries” and check how the access of administrator user will be changed.