0

I am using entity_metadata_wrapper() for getting values from the user profile.

This is my code:

$user_wrapper = entity_metadata_wrapper('user', $uid);
$user_name = $user_wrapper->name->value();

How do I get the user picture field from $user_wrapper?

0

1 Answer 1

1

You can get the information about user picture indirectly as follows:

$user_picture = $user_wrapper->value()->picture;

I said indirectly, since the picture object itself is not an entity wrapper anymore, so you cannot chain it further using entity_metadata_wrapper functions. However, it should have all the information you need about the user picture, like the fid, filename, uri, filemime, filesize, metadata, and any other fields that could be attached to a file, for instance using File Entity module.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.