This is a snippet from our current distribution's install profile. The password is set later with another helper function.
/** * Implementation of hook_form_alter(). * * Allows the profile to alter the site-configuration form. This is * called through custom invocation, so $form_state is not populated. */ function cws_d6_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'install_configure') { // echo '<pre>'; // print_r($form); // echo '</pre>'; // Set default for site name field. $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME']; $form['site_information']['site_mail']['#default_value'] = 'noreply@example.edu'; $form['admin_account']['account']['name']['#default_value'] = 'username'; $form['admin_account']['account']['mail']['#default_value'] = 'username@example.edu'; $form['admin_account']['account']['pass']['#access'] = FALSE; $form['admin_account']['account']['pass']['#required'] = FALSE; // autosubmit form $form['#post']['site_information'] = $form['site_information']; $form['#post']['admin_account'] = $form['admin_account']; $form['#post']['server_settings'] = $form['server_settings']; $form['#post']['clean_url'] = $form['clean_url']; $form['#post']['update_status_module'] = $form['update_status_module']; $form['#post']['submit'] = $form['submit']; $form['#post']['#action'] = $form['#action']; drupal_prepare_form($form_id, $form, $form); drupal_process_form($form_id, $form, $form); } }
