You are here

function uc_file_remove_user_file_by_id in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \uc_file_remove_user_file_by_id()
  2. 7.3 uc_file/uc_file.module \uc_file_remove_user_file_by_id()

Removes a user's downloadable file by hash key.

Parameters

$uid: A Drupal user ID.

$key: The unique hash associated with the file.

1 call to uc_file_remove_user_file_by_id()
uc_file_user_form_submit in uc_file/uc_file.module
Submit handler for per-user file download administration.

File

uc_file/uc_file.module, line 1589

Code

function uc_file_remove_user_file_by_id($user, $fid) {
  $file = uc_file_get_by_id($fid);
  db_query("DELETE FROM {uc_file_users} WHERE uid = %d AND fid = %d", $user->uid, $fid);

  // Echo the deletion only if something was actually deleted.
  if (db_affected_rows()) {
    drupal_set_message(t('%user has had %file removed from his/her downloadable file list.', array(
      '%user' => $user->name,
      '%file' => $file->filename,
    )));
  }
}