Project:Profile CSV
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Here's a patch with some changes I needed recently (against D6-dev only).
The most important one to select any column in the users table, based on it's schema.

Changes were made quickly, still need to be tested and may require some improvements.
Still, maybe someone might find it usefull :)

AttachmentSize
profile_csv-D6.patch11.43 KB
profile_csv.module.zip2.91 KB

Comments

#1

If someone tests this and confirms it is working and does not break backward compatibility, then I will commit it.

#2

I would like to see this committed, but also with a date formatter for the timestamp fields.

#3

Priority:minor» normal

$ patch -p0 --dry-run < profile_csv-D6.patch
patching file profile_csv.module
Hunk #1 succeeded at 1 with fuzz 2.
Hunk #9 FAILED at 153.
Hunk #10 FAILED at 167.
Hunk #11 succeeded at 206 (offset 1 line).
Hunk #12 succeeded at 262 (offset 1 line).
Hunk #13 succeeded at 276 (offset 1 line).
Hunk #14 succeeded at 286 (offset 1 line).
2 out of 14 hunks FAILED -- saving rejects to file profile_csv.module.rej

The patch fails against the current version of the module.

Also, can this patch be simplified as much as possible?

#4

Status:needs review» needs work

I like this feature because it answers a lot of needs at once.

Marking as needs work though.

#5

Status:needs work» fixed

I tidied this up and committed it.

Thanks.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#7

Like #2 I wanted this but with the dates formatted nicely. To achieve this I changed the _profile_csv_get_user function as follows:

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]);
    }
  }
  $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;
     
      // Formatting the date
      if ($col == "created") {
      $user[$col] = format_date($user[$col], 'custom', 'j M, Y', NULL);
      }

    }
  };
  return $user;
}
nobody click here