I suggest you use the Kint debugger to see the actual values in the $values array and $field object. $field->id == 'dropdown_field_id' will never be true. 'dropdown_field_id', if anything, is a field key. Field ids are always numeric values. You asked about selecting users by user role. This snippet doesn't address the role.
Please login or Register to submit your answer