Check if entity reference field (user) contains current user I have a node page of Project content type which contains a multiselect enitity reference field of user type called field_team. I also have a block created by my custom module which is displayed at Project type pages only. What i'm trying to achieve is to do smth like this:

if ($current_node-&gt;field_team contains $current_user-&gt;uid) {
$output = 'some_specific_content'; 
} else {
$output = 'you are not a team member of this project';
}


How can I check if currently viewed node contains current user in its reference field?
Will be very thankful for any help or advice.
Check following code:

global $user;
$team_members = array();
foreach($current_node-&gt;field_team['und'] as $team){
$team_members[] = $team['target_id'];
}

if (in_array($user-&gt;uid, $team_members)) {
$output = 'some_specific_content'; 
} else {
$output = 'you are not a team member of this project';
}