I'm trying to print an image field from profile2 to author pane.Here is my code:

<?php $profile = profile2_load_by_user($account,'main'); ?>   
        <div class="author-pane-line author-image">
        <span class="author-pane-label"><?php print t('image'); ?>:</span>
        <?php print check_plain($profile->field_tx['und'][0]['value']); ?>
        </div>

But there is no any image,just the lable "image".

So I tried a integer field,but It print correctly.

Please help with it,thanks a lot!!

Comments

jay.lee.bio’s picture

I don't know the answer, but this might help: https://www.drupal.org/node/1360258, #7

jay.lee.bio’s picture

I just got the following to actually show up, so just change it to suit your needs:

<?php
$account = user_load($user->uid);
$profile = profile2_load_by_user($account, 'profile');
print $profile->field_user_first_name['und']['0']['value'];
?>