I am trying to show the profile2 fields in my user edit page, but I can't figure out how for the life of me. I read that they should autmomatically show up but it's not happening..
I have added the following in my template.php:
function mytheme_theme($existing, $type, $theme, $path){
$hooks['user_profile_form'] = array(
'render element' => 'form',
'template' => 'user-profile-form',
'path' => drupal_get_path('theme','mytheme').'/templates');
return $hooks;
}
function mytheme_preprocess_user_profile_form(&$variables) {
global $user;
$variables['form'] = drupal_render($variables['form']['account']);
//???
$profile2 = mytheme_profile_form();
}
function mytheme_form_user_profile_form_alter(&$form, &$form_state){
global $user;
$mainprofile = profile2_load_by_user($user->uid, 'main');
$profile = profile2_load_by_user($user->uid, 'basic_information');
//Example field
$form['profile_basic_information']['field_field_1']['und']['#id'] = 'school-district';
$form['profile_basic_information']['field_field_1']['und']['#attributes']['data-placeholder'] = "Choose your Field1";
$form['profile_basic_information']['field_field_1']['und']['#attributes']['class'] = "input-xlarge";
$form['profile_basic_information']['field_field_1']['und']['#default_value'] = !empty($profile) && isset($profile->field_field_1['und']) ? $profile->field_field_1['und'][0]['value'] : '';
}
function mytheme_form_user_profile_form_submit(&$form, &$form_state){
//TODO
}
I also have user-profile-form.tpl which right now consists just of echo $form;
But the fields I am adding to the form are not being added.. I'm not sure that the form_alter is affecting the output (it is running, though).