You are here

function hook_commerce_file_can_download in Commerce File 7.2

Lets modules prevent the download of a file.

Returning FALSE will cause the commerce_file formatter to show the file without the download link and the download callback to return "Access denied".

Parameters

$license: The license entity.

$file: The file entity.

$account: The user to check for.

See also

commerce_file_can_delete().

1 invocation of hook_commerce_file_can_download()
commerce_file_can_download in ./commerce_file.module
Returns whether the licensed file can be downloaded.

File

./commerce_file.api.php, line 24
Hooks provided by the Commerce File module.

Code

function hook_commerce_file_can_download($license, $file, $account) {
  if ($account->name == 'john') {

    // We don't like you, John.
    return FALSE;
  }
  else {
    return TRUE;
  }
}