field_attach_form with user picture and user mail? I'm trying to build a custom "edit profile" page and use a lot the field_attach_form function in order to build it : 

field_attach_form('user', $user_entity, $form, $form_state, NULL, array('field_name' =&gt; 'field_user_firstname'));
field_attach_form('user', $user_entity, $form, $form_state, NULL, array('field_name' =&gt; 'field_user_lastname'));
field_attach_form('user', $user_entity, $form, $form_state, NULL, array('field_name' =&gt; 'field_user_organisation'));


I'm trying to insert input for user mail and user picture, but as they are properties and not fields, the following snippet is not working.

field_attach_form('user', $user_entity, $form, $form_state, NULL, array('field_name' =&gt; 'mail'));


Is it possible to insert user's properties form with this function ? or is there another way ?
I was working on a similar task; my task was to put the address field into the popup and I used the following code to accomplish it. I looked at modules/user/user.page.inc for it.

    function MYMODULE_init() {
         //To avoid user_profile_form_validate function not found
         module_load_include('inc', 'user', 'user.pages');
         } //end init function

        //Custom form for fields
        function MYMODULE_form($form, &amp;$form_state) {

        $form = array();
        global $user;
        $account = user_load($user-&gt;uid);

        if (!isset($form_state['user'])) {
            $form_state['user'] = $account;
          }
          else {
            $account = $form_state['user'];
          }

        $form['#user'] = $account;
        user_account_form($form, $form_state);
        // Attach field widgets.
            $langcode = entity_language('user', $account);
            field_attach_form('user', $account, $form, $form_state, $langcode);
        //All fields get attached so removing unnecessary fields.  
            unset($form['account']['pass']);
            unset($form['account']['roles']);
 $key = array_search('user_validate_current_pass', form['#validate']);
    if ($key !== FALSE) {
      unset($form['#validate'][$key]);
    }
    // hide the current password fields
    $form['account']['current_pass_required_value']['#access'] = FALSE;
    $form['account']['current_pass']['#access'] = FALSE;

            $form['actions'] = array('#type' =&gt; 'actions');
            $form['actions']['submit'] = array(
            '#type' =&gt; 'submit',
            '#value' =&gt; t('Save'),
           );

          $form['actions']['cancel'] = array(
            '#type' =&gt; 'submit',
            '#value' =&gt; t('Cancel'),
            '#submit' =&gt; array('MYMODULE_form_cancel'),
            '#limit_validation_errors' =&gt; array(),
          );
          $form['#validate'][] = 'user_profile_form_validate';
          // Add the final user profile form submit handler.
          $form['#submit'][] = 'user_profile_form_submit';

          return $form;
        }

        // Add function for CANCEL button.
        function MYMODULE_form_cancel(&amp;$form_state) {
        $url = $_GET['destination'] ? $_GET['destination'] : 'choose/your/path';
          drupal_goto($url);
        }