Extract the CSS class depending on the user type
If $user is the user object, then $user-&gt;roles is an array containing all the roles the user has. Drupal doesn't have the concept of user type, and the user roles are the closest it has.

If you want to check if the user has the "editor" role, for example, you can use code similar to the following one:

$global $user;

if (in_array(array_values($user-&gt;roles), "editor")) {
  // The user has the "editor" role.
}


Depending on what you are trying to achieve, you could also be interested in checking if the user has a specific permission, which is what is normally done in Drupal, where instead of checking the role assigned to a user, it is checked which permission the user has (using user_access()).

As for hiding a form field, this can be done implementing hook_form_alter(), or hook_form_FORM_ID_alter() and altering the property "#access" of the form field.

Supposing that "example_form" is the form ID for the form you want to modify, and "file" is the ID for the form field to change, then you can use code similar to the following one ("mymodule" is the name of the module; change it to match the name of the module that contains the hook):

function mymodule_form_example_form_alter(&amp;$form, &amp;$form_state) {
  $form['file']['#access'] = user_access('administer file');
}


"Administer file" is the permission that the user needs to have.
Alternatively, if you want to only check if the user has the "editor" role, you can use code similar to the following one:

function mymodule_form_example_form_alter(&amp;$form, &amp;$form_state) {
  global $user;

  $form['file']['#access'] = in_array(array_values($user-&gt;roles), "editor");
}


The global variable contains the user object for the currently logged in user.