I fixed problem with the query to display all downloads... there was a problem with the "join upload.description with files_download.filename"

Here are the right queries :

  if(user_access('view all downloads count')) {
    $result = db_query("SELECT fd.filename, fd.count, fd.timestamp, u.nid, n.type FROM {file_downloads} fd JOIN {files} f ON f.filename = fd.filename JOIN {upload} u ON f.fid = u.fid JOIN {node} n ON n.nid = u.nid"  . tablesort_sql($header), $fileDirectoryPath);
  }
  else {
    $result = db_query("SELECT fd.filename, fd.count, fd.timestamp, u.nid, n.type FROM {file_downloads} fd JOIN {files} f ON f.filename = fd.filename JOIN {upload} u ON f.fid = u.fid JOIN {node} n ON n.nid = u.nid WHERE n.uid = %d" . tablesort_sql($header), $fileDirectoryPath, $user->uid);
  }

Comments

Chill35’s picture

Yeah I added a JOIN between the {upload} and {files} tables on the 'fid'. I no longer confuse 'description' and 'filename'.

There were major changes -- and a new table added for files -- between Drupal 5 and 6. I must have been doped when I upgraded my module to Drupal 6. I saw the change but made bad choices...

My apologies.

Look for the next release 6.x-1.2

Let me know if that fixes all problems, if you can.

:)

Chill35’s picture

Assigned: Unassigned » Chill35
Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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