function hook_file_entity_access


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 file_entity.api.php hook_file_entity_access($op, $file, $account)
cle7 file_entity.api.php hook_file_entity_access($op, $file, $account)
elmsmedia7 file_entity.api.php hook_file_entity_access($op, $file, $account)
icor7 file_entity.api.php hook_file_entity_access($op, $file, $account)
meedjum_blog7 file_entity.api.php hook_file_entity_access($op, $file, $account)
mooc7 file_entity.api.php hook_file_entity_access($op, $file, $account)

Control access to a file.

Modules may implement this hook if they want to have a say in whether or not a given user has access to perform a given operation on a file.

The administrative account (user ID #1) always passes any access check, so this hook is not called in that case. Users with the "bypass file access" permission may always view and edit files through the administrative interface.

Note that not all modules will want to influence access on all file types. If your module does not want to actively grant or block access, return FILE_ENTITY_ACCESS_IGNORE or simply return nothing. Blindly returning FALSE will break other file access modules.


string $op: The operation to be performed. Possible values:

  • "create"
  • "delete"
  • "update"
  • "view"
  • "download"

object $file: The file on which the operation is to be performed, or, if it does not yet exist, the type of file to be created.

object $account: A user object representing the user for whom the operation is to be performed.

Return value

string|NULL FILE_ENTITY_ACCESS_ALLOW if the operation is to be allowed; FILE_ENTITY_ACCESS_DENY if the operation is to be denied; FILE_ENTITY_ACCESS_IGNORE to not affect this operation at all.

Related topics

1 function implements hook_file_entity_access()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

file_entity_file_entity_access in sites/all/modules/ulmus/file_entity/file_entity.module
Implements hook_file_entity_access().
1 invocation of hook_file_entity_access()
file_entity_access in sites/all/modules/ulmus/file_entity/file_entity.module
Determine if a user may perform the given operation on the specified file.


sites/all/modules/ulmus/file_entity/file_entity.api.php, line 188
Hooks provided by the File Entity module.


function hook_file_entity_access($op, $file, $account) {
  $type = is_string($file) ? $file : $file->type;

  if ($op !== 'create' && (REQUEST_TIME - $file->timestamp) < 3600) {
    // If the file was uploaded in the last hour, deny access to it.

  // Returning nothing from this function would have the same effect.



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.