I've tried using 2 different functions, where both successfully sets the value to 'invisible' with a dsm($form) check. However, the label is still being displayed.
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_register_form':
$form['profile_users']['field_username']['#title_display'] = 'invisible';
$form['captcha']['#title_display'] = "invisible";
break;
}
}
and:
function MYMODULE_form_profile2_edit_PROFILETYPE_form_alter(&$form, &$form_state){
$form['profile_PROFILETYPE']['field_username']['#title_display'] = 'invisible';
}
I do not encounter this problem for the username, password and email fields.
Edit: I've also tried:
$form['profile_users']['field_username']['und']['#title'] = '';
$form['profile_users']['field_username']['und']['#title_display'] = "invisible";