1.20.x file.api.php hook_query_file_access_alter(QueryAlterableInterface $query)

Control access to listings of files.

Parameters

object $query: A query object describing the composite parts of a SQL query related to listing files.

See also

hook_query_TAG_alter()

Related topics

File

modules/file/file.api.php, line 281
Hooks for file module.

Code

function hook_query_file_access_alter(QueryAlterableInterface $query) {
  // Only show files that have been uploaded more than an hour ago.
  $query->condition('timestamp', REQUEST_TIME - 3600, '<=');
}