Is there a way to display the user picture (set by the user in the Account Settings) in profile2.tpl.php?

I have ~300 users with user pictures already set in their account settings.

I want to use Profile2, and to display the picture set in someone's account settings on their profile2 page.

Adding this to profile2.tpl.php has not worked:


<?php global $user;
   	$user = user_load($user->uid);
         print theme_image_style(
                array(     
                    'style_name' => 'thumbnail',
                    'path' =>$user->picture->uri,
                    'attributes' => array(
                    'class' => 'avatar'
                    ),
                'width' => NULL,
                'height' => NULL,       
                )
            );  
	
        ?>

Comments

radiocontrolled’s picture

Status: Active » Fixed

Hi, I just wanted to share the solution here that I found, in case it could help anyone. What I had to do was figure out the uid of the user whose profile is displaying:

<?php 
       $user = user_load($content['field_biography']['#object']->uid);
         print theme_image_style(
                array(     
                    'style_name' => 'thumbnail',
                    'path' =>$user->picture->uri,
                    'attributes' => array(
                    'class' => 'avatar'
                    ),
                'width' => NULL,
                'height' => NULL,       
                )
            );  
    
        ?>
radiocontrolled’s picture

Status: Fixed » Closed (fixed)
radiocontrolled’s picture

Issue summary: View changes

corrected indentation.