You are here

function nicemessages_field_access in Nice messages 7

Same name and namespace in other branches
  1. 7.2 nicemessages.module \nicemessages_field_access()

Implements hook_field_access().

File

./nicemessages.module, line 64
Nicemessages module

Code

function nicemessages_field_access($op, $field, $entity_type, $entity, $account) {
  if ($field['field_name'] == NICEMESSAGES_FIELDNAME) {

    // Users with toggle nicemessages permission can edit their settings.
    if ($op == 'edit') {
      return user_access('toggle nicemessages', $account);
    }
    else {
      if ($op == 'view') {
        return user_access('administer users');
      }
    }
  }
  return TRUE;
}