function translation_user_can_translate_node

Check if the user has permissions to translate a node.

Parameters

$node: Node being checked.

$account: User object to check translation permissions.

Return value

TRUE if the user can translate a node, FALSE otherwise.

3 calls to translation_user_can_translate_node()
translation_form_node_form_alter in drupal/core/modules/translation/translation.module
Implements hook_form_BASE_FORM_ID_alter() for node_form().
translation_node_access in drupal/core/modules/translation/translation.module
Implements hook_node_access().
_translation_tab_access in drupal/core/modules/translation/translation.module
Access callback: Checks that the user has permission to 'translate all content' or to 'translate own content' and has created the node being translated.

File

drupal/core/modules/translation/translation.module, line 150
Manages content translations.

Code

function translation_user_can_translate_node($node, $account = NULL) {

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $GLOBALS['user'];
  }
  return node_access('view', $node, $account) && (user_access('translate all content', $account) || $node->uid == $account->uid && user_access('translate own content', $account));
}