How to contextual filter a view by a field value? QUESTION

I have an address field in my user form, from the address field module. 

I have a content type named "project" which also have an address field and users can pick up a country related to the country the project will belong to.

I want to make a view filtering all the projects related to the logged-in user's address country field. 

TRY

My trick is to make a user-view with a author-content relationship filtered on the content type project. Now I have the two fields in the view, I'm trying to compare them with a contextual php filter.

I tried to use php filter based on this post 

$node = node_load($data-&gt;nid);
$user = user_load($user-&gt;uid);

$field_user_country = field_get_items('user', $user, 'field_user_address_country');
$country_user = field_view_value('user', $user, 'field_user_country', $field_user_country[0]);

$field_project_country = field_get_items('node', $node, 'field_project_range_country_country');
$project_country = field_view_value('node', $node, 'field_project_country', $$field_project_country[0]);

if ($price_a = $price_b) {
  return TRUE;
}


The fact is field_user_address_country is actually stored under field_data_field_user_address in the database.

Same for field_project_range_country_country which is stored under field_data_field_project_range_country

What is the best way to do this ? Is what I'm trying to do possible ?

UPDATE 1

Clear code which give me an ajax error :

$node = node_load($data-&gt;nid);
$user = user_load($user-&gt;uid);

$field_user_country = field_get_items('user', $user, 'field_user_address_country');
$country_user = field_view_value('user', $user, 'field_user_address_country', $field_user_country[0]);

$field_project_country = field_get_items('node', $node, 'field_project_range_country_country');
$project_country = field_view_value('node', $node, 'field_project_range_country_country', $field_project_country[0]);

if ($country_user == $project_country) {
  return TRUE;


UPDATE 2

Here the new code which is still giving me an ajax error : 


  EntityMalformedException : Missing bundle property on entity of type
  node


$node = node_load($data-&gt;nid);
$user = user_load($user-&gt;uid);

$field_user_country = field_get_items('user', $user, 'field_user_address_country');
$country_user = field_view_value('user', $user, 'field_user_address_country', $field_user_country[0]);

$field_project_country = field_get_items('node', $node, 'field_project_range_country_country');
$project_country = field_view_value('node', $node, 'field_project_range_country_country', $field_project_country[0]);

if ($country_user == $project_country) {
  return $country_user;
}


Have a bigger ajax error (like 15 lines) if I put 

global $user 
$node = ($node = menu_get_object()) ? $node-&gt;nid : NULL;


At the beginning of my code.
Create a block view of Show: content, in contextual filter add Country. 

Add this to your view contextual filter:

  global $user; // gets current logged in user object

  if (isset($user-&gt;field_user_address[LANGUAGE_NONE][0]['country'])) {      
    $user_country = $user-&gt;field_user_address[LANGUAGE_NONE][0]['country'];
    return $user_country;
  }