I've installed Profile CSV on a site I am working on and configured it to include some custom fields I've added to my user profiles (checkboxes for the user to be added to the client's elist and a field for cell phone number for SMS promotions). Even though I have all of them checked off in the module's configuration page, when I export the CSV, it includes the headers at the top of those columns in the CSV but none of the data for each user. I also have "Real Name" checked in the config and nothing shows in that field of the CSV either.

Comments

wafaa’s picture

Status: Active » Postponed (maintainer needs more info)

Can not reproduce this problem.

sam_bolton’s picture

I had a similar problem and found the solution here: http://drupal.org/node/83310

The other way around it is to change the profile from hidden to private or public.

chrol’s picture

I have the same issue; Only headers show up - no data at all.

The previous post seems to refer to 4.x rather than 5.x - how similar are they?

I have another problem which may be related; my userlist doesn't get populated with profile data either.

I have usernode but not nodeprofile.

Dr_Tom’s picture

Same problem here...using Drupal 5. Works fine if fields all set to 'Hidden' but then a new user doesn't see them when filling out the form (therefore makes it irrelevant). Patch seems to be for 4.6....anyone managed to sort this out yet?

Dr_Tom’s picture

After looking, I realised it was a problem with deciding where to look for the table data based on visibility.

So I modified the _profile_csv_get_profile function in profile_csv.module with these comments:

function _profile_csv_get_profile($uid=0,$user_data=NULL) {
  $profile_fields = _profile_csv_get_profile_fields();  
  $profile_result = array();
  foreach($profile_fields  as $profile_field) {
    //if ($profile_field ['visibility'] == 4) {
      //$value = try to get it from the $user_data
      $value = $user_data[$profile_field['name']];
    //} 
    //else {
    //  $value = db_result(db_query("SELECT pv.value FROM {profile_fields} pf, {profile_values} pv
    //    WHERE pv.fid = pf.fid
    //    AND pf.name = '%s'
    //    AND pv.uid = %d", $profile_field['name'], $uid));
    //}
   
    if ($profile_field['type'] == 'date') {
      if ($value !== 0) {
        $value = unserialize($value);
        $value = $value['year'] .'-'. $value['month'] .'-'. $value['day'];
      }
    }  
    $profile_result[] = $value;
  }
  return $profile_result;
}

It works fine, but (being a raher poor PHP coder) I'm pretty sure it's not that elegant and I'm not sure if I've made any big security related mistakes!?

petya_vulcheva’s picture

Hi

I tried this but it didn't work for me. Some of my private profile fields are still empty in the csv export file. Can anyone help?
thanks

rares’s picture

I did it the other way around and it worked:

  foreach($profile_fields  as $profile_field) {
    //if ($profile_field ['visibility'] == 4) {
      //$value = try to get it from the $user_data
      //$value = $user_data[$profile_field['name']];
    //} 
    //else {
      $value = db_result(db_query("SELECT pv.value FROM {profile_fields} pf, {profile_values} pv
        WHERE pv.fid = pf.fid
        AND pf.name = '%s'
        AND pv.uid = %d", $profile_field['name'], $uid));
    //}

Does this module still have a maintainer?