You are here

function og_ui_field_access in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_ui/og_ui.module \og_ui_field_access()

Implements hook_field_access().

File

og_ui/og_ui.module, line 266
Organic groups UI.

Code

function og_ui_field_access($op, $field, $entity_type, $entity, $account) {
  global $user;
  if ($field['field_name'] != OG_AUDIENCE_FIELD) {
    return;
  }
  if (!$user->uid) {

    // User is anonymous, and user register might try to add the group-audience
    // field.
    return;
  }
  if ($op != 'edit') {
    return;
  }
  if ($entity_type != 'user') {
    return;
  }
  if (!user_access('administer group', $account)) {
    return FALSE;
  }
}