Missing data in outputted CSV for Categories

gnotorious - March 21, 2007 - 15:49
Project:Profile CSV
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

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.

#1

wafaa - March 24, 2007 - 03:00
Status:active» postponed (maintainer needs more info)

Can not reproduce this problem.

#2

sam_bolton - March 29, 2007 - 08:23

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.

#3

chrol - March 29, 2007 - 16:33

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.

#4

Dr_Tom - June 14, 2007 - 08:08

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?

#5

Dr_Tom - June 14, 2007 - 13:45

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!?

#6

petya_vulcheva - June 10, 2008 - 08:23

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

#7

rares - April 30, 2009 - 01:27

I did it the other way around and it worked:

<?php
 
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?

 
 

Drupal is a registered trademark of Dries Buytaert.