Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. /**
  2. * Implements hook_field_access
  3. */
  4. function MODULE_field_access($op, $field, $entity_type, $entity, $account){
  5. // Check view access to invoice field
  6. if ($field['field_name'] == 'field_pdf_invoice' && $op == 'view') {
  7. // Allow access if current user is viewing own account field
  8. if($entity_type == 'user' && $account->uid == $entity->uid){
  9. return TRUE;
  10. }elseif(user_access('administer users'){
  11. // Allow access to admins
  12. return TRUE;
  13. }
  14. // Default deny view.
  15. return FALSE;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement