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->uid);
$uri = $account->picture->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->picture.
. - The result of
print_r($account->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 ( ) )