Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _get_user_account_id() {
- global $user;
- return db_query("SELECT `field_account_target_id` FROM {field_data_field_account} where `entity_id`=:user_id and `bundle` = 'user'", array('user_id' => $user->uid))->fetchField();
- }
- function custom_node_access($node, $op, $account) {
- $account_id = _get_user_account_id();
- if ($op == 'view' || $op == 'update') {
- if ($node->field_account['und'][0]['target_id'] != $account_id) {
- return NODE_ACCESS_DENY;
- }
- }
- return NODE_ACCESS_ALLOW;
- }
Add Comment
Please, Sign In to add comment