Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_field_access
- */
- function MODULE_field_access($op, $field, $entity_type, $entity, $account){
- // Check view access to invoice field
- if ($field['field_name'] == 'field_pdf_invoice' && $op == 'view') {
- // Allow access if current user is viewing own account field
- if($entity_type == 'user' && $account->uid == $entity->uid){
- return TRUE;
- }elseif(user_access('administer users'){
- // Allow access to admins
- return TRUE;
- }
- // Default deny view.
- return FALSE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement