Hide Profile2 fields depending on it's value when viewing user profile I am relatively new to drupal and for days I'm stuck.

I need to hide fields from the user profile page when they have a specific value. Adding a CSS class would also do it. But I prefer deleting the array element.

I try to use the hook_profile2_view_alter() function in my template php. Sure I can access the field options but not it's value directly.

Perhaps I'm digging in the wrong hole and there is a smooth "Drupal way" to do it.
You'd be better off putting your code in a custom module, as you can implement hook_profile2_view() instead. That will give you far more control over the output.

Without more specifics it's hard to be accurate but generally speaking the code would look something like this:

function MYMODULE_profile2_view($profile, $view_mode, $langcode) {
  $field_items = field_get_items('profile2', $profile, 'field_name_of_field');
  if ($field_items) {
    $value = $field_items[0]['value'];

    if ($value == 'something') {
      $profile-&gt;content['field_name_of_field']['#access'] = FALSE;
    }
  }
}