Index: admin/uploaduser.php
===================================================================
RCS file: /cvsroot/moodle/moodle/admin/uploaduser.php,v
retrieving revision 1.68.2.11
diff -c -r1.68.2.11 uploaduser.php
*** admin/uploaduser.php	2 Apr 2008 06:09:57 -0000	1.68.2.11
--- admin/uploaduser.php	22 Apr 2008 08:02:38 -0000
***************
*** 66,73 ****
  $bulknurl  = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
  
  // array of all valid fields for validation
! $STD_FIELDS = array('firstname', 'lastname', 'username', 'email', 'city', 'country', 'lang', 'auth', 'timezone', 'mailformat', 'maildisplay', 'maildigest', 'htmleditor',
!                     'ajax', 'autosubscribe', 'mnethostid', 'institution', 'department', 'idnumber', 'icq', 'phone1', 'phone2', 'address', 'url', 'description',
                      'oldusername', 'emailstop', 'deleted',  'password');
  
  $PRF_FIELDS = array();
--- 66,73 ----
  $bulknurl  = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
  
  // array of all valid fields for validation
! $STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email', 'city', 'country', 'lang', 'auth', 'timezone', 'mailformat', 'maildisplay', 'maildigest', 'htmleditor',
!                     'ajax', 'autosubscribe', 'mnethostid', 'institution', 'department', 'idnumber', 'skype', 'msn', 'aim', 'yahoo', 'icq', 'phone1', 'phone2', 'address', 'url', 'description',
                      'oldusername', 'emailstop', 'deleted',  'password');
  
  $PRF_FIELDS = array();
Index: admin/user/user_bulk_download.php
===================================================================
RCS file: /cvsroot/moodle/moodle/admin/user/user_bulk_download.php,v
retrieving revision 1.1.2.1
diff -c -r1.1.2.1 user_bulk_download.php
*** admin/user/user_bulk_download.php	20 Dec 2007 10:54:07 -0000	1.1.2.1
--- admin/user/user_bulk_download.php	22 Apr 2008 08:02:38 -0000
***************
*** 17,32 ****
      redirect($return);
  }
  
- 
  if ($format) {
      $fields = array('id'        => 'id',
!                     'username'  => get_string('username'),
!                     'email'     => get_string('email'),
!                     'firstname' => get_string('firstname'),
!                     'lastname'  => get_string('lastname'),
!                     'idnumber'  => get_string('idnumber'),
!                     'city'      => get_string('city'),
!                     'country'   => get_string('country'));
  
      switch ($format) {
          case 'csv' : user_download_csv($fields);
--- 17,47 ----
      redirect($return);
  }
  
  if ($format) {
      $fields = array('id'        => 'id',
!                     'username'  => 'username',
!                     'email'     => 'email',
!                     'firstname' => 'firstname',
!                     'lastname'  => 'lastname',
!                     'idnumber'  => 'idnumber',
!                     'institution' => 'institution',
!                     'department' => 'department',
!                     'phone1'    => 'phone1',
!                     'phone2'    => 'phone2',
!                     'city'      => 'city',
!                     'url'       => 'url',
!                     'icq'       => 'icq',
!                     'skype'     => 'skype',
!                     'aim'       => 'aim',
!                     'yahoo'     => 'yahoo',
!                     'msn'       => 'msn',
!                     'country'   => 'country');
! 
!     if ($extrafields = get_records_select('user_info_field')) {
!         foreach ($extrafields as $n=>$v){
!             $fields['profile_field_'.$v->shortname] = 'profile_field_'.$v->name;
!         }
!     }
  
      switch ($format) {
          case 'csv' : user_download_csv($fields);
***************
*** 56,61 ****
--- 71,77 ----
      global $CFG, $SESSION;
  
      require_once("$CFG->libdir/odslib.class.php");
+     require_once($CFG->dirroot.'/user/profile/lib.php');
  
      $filename = clean_filename(get_string('users').'.ods');
  
***************
*** 77,82 ****
--- 93,99 ----
              continue;
          }
          $col = 0;
+         profile_load_data($user);
          foreach ($fields as $field=>$unused) {
              $worksheet[0]->write($row, $col, $user->$field);
              $col++;
***************
*** 92,97 ****
--- 109,115 ----
      global $CFG, $SESSION;
  
      require_once("$CFG->libdir/excellib.class.php");
+     require_once($CFG->dirroot.'/user/profile/lib.php');
  
      $filename = clean_filename(get_string('users').'.xls');
  
***************
*** 113,118 ****
--- 131,137 ----
              continue;
          }
          $col = 0;
+         profile_load_data($user);
          foreach ($fields as $field=>$unused) {
              $worksheet[0]->write($row, $col, $user->$field);
              $col++;
***************
*** 126,131 ****
--- 145,152 ----
  
  function user_download_csv($fields) {
      global $CFG, $SESSION;
+     
+     require_once($CFG->dirroot.'/user/profile/lib.php');
  
      $filename = clean_filename(get_string('users').'.csv');
  
***************
*** 149,154 ****
--- 170,176 ----
          if (!$user = get_record('user', 'id', $userid)) {
              continue;
          }
+         profile_load_data($user);
          foreach ($fields as $field=>$unused) {
              $row[] = str_replace($delimiter, $encdelim, $user->$field);
          }

