How to use profile2 profile type in custom form? I'm building a multi step sign up form for my drupal 7 website, so I want to use one of profile type from profile2 in first step.
For such purpose I'm using this code:

function personal_info_form($form, $form_state) {
    $form_state['profiles']['main'] = profile2_get_types('main');
    profile2_attach_form($form, $form_state);
    $form['#validate'][] = 'profile2_form_validate_handler';
    $form['#submit'][] = array('profile2_form_submit_build_profile', 'profile2_form_submit_handler');
    return $form;
}


But still getting error, you can visit this page to see the exact error
http://dev.BlindHelp.net/user/register . Any help?
i Suggest to use hook_form_alter or hook_FORM_ID_form_alter to perform specific task of existing form of profile2.

function mymodule_form_alter(&amp;$form, $form_state, $form_id)  {
    switch ($form_id)  {
        case 'comment_form_id':
            $form['your_comment_form_name'] = array (
              '#type' =&gt; 'checkbox',
              '#title' =&gt; t ('Subscribe to replies to this comment'),
            );
            break;
        case 'user_register_form' :
           $form['actions']['submit']['#value'] = t('Submit');
           break;
     }
  }