You are here

function content_access in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 content.module \content_access()

Determine whether the user has access to a given field.

Parameters

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

  • "edit"
  • "view"

$field: The field on which the operation is to be performed.

$account: (optional) The account to check, if not given use currently logged in user.

$node: (optional) The node on which the operation is to be performed.

Return value

TRUE if the operation is allowed; FALSE if the operation is denied.

7 calls to content_access()
content_content_field_content_type_render in includes/panels/content_types/content_field.inc
Output function for the 'field' content type.
content_diff in includes/content.diff.inc
Implementation of hook_diff()
content_field in ./content.module
Implementation of hook_field(). Handles common field housekeeping.
content_field_form in includes/content.node_form.inc
Create a separate form element for each field.
content_format in ./content.module
Format a field item for display.

... See full list

1 string reference to 'content_access'
content_views_field_views_data in includes/views/content.views.inc

File

./content.module, line 2316
Allows administrators to associate custom fields to content types.

Code

function content_access($op, $field, $account = NULL, $node = NULL) {
  global $user;
  if (is_null($account)) {
    $account = $user;
  }

  // Check for valid field data.
  if (!isset($field['field_name'])) {
    return FALSE;
  }
  $access = module_invoke_all('field_access', $op, $field, $account, $node);
  foreach ($access as $value) {
    if ($value === FALSE) {
      return FALSE;
    }
  }
  return TRUE;
}