I am trying to figure out how to add the image for the logged in user to a template file.

I have tried the following:

 print $user_picture;

and I receive this error:

Notice: Undefined variable: user_picture in include()

I see this in another template file and figured it would work in the template file I am editing. What am I doing wrong?




turbogeek’s picture

You might want to check if a picture has been uploaded with a simple conditional statement, and maybe have a default image fallback, but this should work:

    global $user;
    $user = user_load($user->uid);
    print theme('image_style', array('style_name' => 'thumbnail', 'path' => $user->picture->uri));
karthik_thangavel’s picture

I got it .Its work's great. Thanks turbogeek.