You are here

function entity_translation_upgrade_access in Entity Translation 7

Access callback.

Performs a redirect to the corresponding field-based translation if the current user has not the permission to access the requested node translation.

1 string reference to 'entity_translation_upgrade_access'
entity_translation_upgrade_menu_alter in entity_translation_upgrade/entity_translation_upgrade.module
Implements hook_menu_alter().

File

entity_translation_upgrade/entity_translation_upgrade.module, line 40
Provides permanent redirects for unavailable node translations.

Code

function entity_translation_upgrade_access($node) {

  // If the user has the right to access the node, we need to do nothing.
  if (node_access('view', $node)) {
    return TRUE;
  }

  // If we have a node translation, we need to redirect the user to the original
  // node.
  if ($node->tnid && $node->nid != $node->tnid) {
    entity_translation_upgrade_redirect($node->tnid, $node->language);
  }
  return FALSE;
}