Hi,

Thank you for your time developing such a useful and easy to use module. I am very new to Drupal and have found all of the other profile export modules much too complicated to understand.

I have a number of custom fields attached to user profiles regarding membership payments they made over the previous years. Obviously I don't want user updating this info on their own, so I have set visibility to 'Hidden profile field, only accessible by administrators, modules and themes.' However, when I do this, the Profile CSV export does not display the data either, even if I am logged in as admin. If I change the visibility setting, Profile CSV can export it but then the user can also modify it.

I have tried both the recommended and development releases. Is there some way I can make this work?

Thanks,

Calvin

Comments

bgladwyn’s picture

I'm working with 6.x-1.1 and have encountered the same problem and can propose a fix, however don't know how to go about proposing a patch etc.

The module already realises that System fields are not contained in the profile_value table and instead looks to extract from the data field of user. However, that field is not included in the SQL statement that pulls the row from the user table. I've solved this through modification of the _profile_csv_get_user function:

function _profile_csv_get_user($uid) {
  $user = array();
  $fields = _profile_csv_users_selected_fields();
  //Verify that the columns haven't been deleted since the last save or the query will fail
  $schema = drupal_get_schema('users');
  foreach ($fields as $field_name => $value) {
    if (!$schema['fields'][$field_name]) {
      unset($fields[$field_name]);
    }
  }

  // bgladwyn 12.09.2012 START
  // Ensure 'data' is also extracted from user table
  $fields[] = 'data';
  // bgladwyn 12.09.2012 END

  $cols = implode(', ', $fields);
  $result = db_query("SELECT $cols FROM {users} u WHERE u.uid = %d", $uid);
  while ($row = db_fetch_object($result)) {
    foreach ($fields as $col) {
      $user[$col] = ($col == 'data') ? unserialize($row->$col) : $row->$col;
    }
  };
  return $user;
}