Cannot use object of type Profile as array Write a script to filter content by country. 


  I have problem Cannot use object of type Profile as array in .... on line 19


Part of code with error

global $user;
$country = "";
if($user-&gt;uid!=1 &amp;&amp; $user-&gt;uid!=0){
  $user_full = profile2_by_uid_load($user-&gt;uid);
  if(!empty($user_full['client'])){
    $country_parent = taxonomy_get_parents($user_full['client']-&gt;field_clcountry['und'][0]['tid']);
This

$user_full = profile2_by_uid_load($user-&gt;uid);


Returns an object, which you are then accessing as an array:

$user_full['client']


Which is illegal in PHP. You should access objects as objects, e.g.

$user_full-&gt;client


Or whatever it might be for that object type.