This filter can be used to control the visibility of the field based on the user/usergroup.
Changelog
since 7.4 version
Parameters
1. $isShowForUser – if the field should be visible or not. By default, it depends on the “Display for Guests” and “Display for Registered Users” options.
2. $currentUser – the object of the current user
3. $args – the parameters of the field. E.g. “Name”, “Description”, “Field is required”, etc.
Usage
add_filter('wpdiscuz_show_field_for_user', function($isShowForUser, $currentUser, $args){ if($currentUser->exists() && in_array('contributor', $currentUser->roles) && $args['name'] == 'Field Name'){ return false; } return $isShowForUser; },15,3);