Undefined property in a Views PHP field I need to have a field with user's picture URL. I'm trying to build it with a Views PHP field.

The field's value is defined

$account = user_load($row-&gt;uid);
$uri = $account-&gt;picture-&gt;uri;
$url = image_style_url('avatar', $uri);
return $url; 


It returns value I expect, but returns also a warning


  Notice: Trying to get property of non-object in __lambda_func() (line 2 of /home/testwww/web/informator/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc (131): runtime-created function).


Do you have any idea on how to solve the issue or what exactly is the cause?

From what I've found out:


it seems that the notice concerns uri attribute of $account-&gt;picture..
The result of print_r($account-&gt;picture) is



        stdClass Object
        (
            [fid] => 168
            [uid] => 58
            [filename] => picture-58-1310836862.jpg
            [uri] => public://portrait/picture-58-1310836862.jpg
            [filemime] => image/jpeg
            [filesize] => 49505
            [status] => 1
            [timestamp] => 1310836862
            [rdf_mapping] => Array
                (
                )
        )
Users who have not uploaded a picture (also the anonymous user) will not have any object set for $account-&gt;picture. You just need to check that there is an object available:

$uri = isset($account-&gt;picture-&gt;uri) ? $account-&gt;picture-&gt;uri : NULL;


image_style_url() will return a bogus URI when passed NULL. You'll want to handle this somehow.

Note:
The user picture is already available as a field, you don't need PHP to get it.

In views 3, you must first add the "Content: Author" relationship before the User fields (including one for the user picture) will show up.