function email_mail_page_access

cis7 email.module email_mail_page_access($entity_type, $entity, $field_info)
cle7 email.module email_mail_page_access($entity_type, $entity, $field_info)
elmsmedia7 email.module email_mail_page_access($entity_type, $entity, $field_info)
icor7 email.module email_mail_page_access($entity_type, $entity, $field_info)
meedjum_blog7 email.module email_mail_page_access($entity_type, $entity, $field_info)
mooc7 email.module email_mail_page_access($entity_type, $entity, $field_info)

Access callback for the email contact page.

Checks whether the current user has view access to the entity. Access checks are performed for the fieldable core entity types, including nodes, users, comments and taxonomy terms. Furthermore entity types using Entity API's access system are supported. For custom entity types that are not using the Entity API, at least the access content permission is checked in the menu access callback.

This function is called within the email page callback, as it takes care of loading the entity itself. If the entity is found, access checks are performed with this function.

Parameters

$entity_type: The entity type

$entity: The entity for which the access should be checked

$field_info: The field info for the email field.

Return value

TRUE if the current user has view access, otherwise FALSE.

1 call to email_mail_page_access()
email_mail_page in sites/all/modules/ulmus/email/email.module
The contact form page.

File

sites/all/modules/ulmus/email/email.module, line 236
Module file for the email module, which creates a email address field.

Code

function email_mail_page_access($entity_type, $entity, $field_info) {
  // Check for field access.
  if (!field_access('view', $field_info, $entity_type, $entity)) {
    return FALSE;
  }

  // Check the access for fieldable core entities, including nodes, users,
  // comments and taxonomy terms.
  if ($entity_type == 'node') {
    return node_access('view', $entity);
  }
  elseif ($entity_type == 'user') {
    global $user;
    if ($entity->uid == $user->uid && $entity->uid) {
      return TRUE;
    }
    if (user_access('administer users') || (user_access('access user profiles') && $entity->status)) {
      return TRUE;
    }
    return FALSE;
  }
  elseif ($entity_type == 'comment') {
    return comment_access('view', $entity);
  }
  elseif ($entity_type == 'taxonomy_term') {
    if (user_access('administer taxonomy') || user_access('access content')) {
      return TRUE;
    }
    return FALSE;
  }

  // Use Entity API for checking the view access for non-core entity types, if
  // the module is installed.
  if (module_exists('entity')) {
    return entity_access('view', $entity_type, $entity);
  }
  return TRUE;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.