Answer the question
In order to leave comments, you need to log in
How to correctly display a field in Drupal 7?
Based on these two articles , Wikidrupal
Habr is
trying to display the user's avatar field on the material page, in the node.tpl.php file.
I tried it in different ways, for example:
<?php
global $user;
$user_data = user_load($user->uid);
$field = field_get_items('user', $user_data, 'field_userphoto');
$output = field_view_value('user', $user_data, 'field_userphoto', $field[0]);
print render($output);
?>
Answer the question
In order to leave comments, you need to log in
print drupal_render(field_view_field('user',$user_data,'field_userphoto',array()));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question