Hi,

I used search but could not find a solution.

I use the imagecache profile image module, and it works great in the profile/comments/blog.

Now i want to use the users profle image in the login box, after some one is logged in.

I use this code:

<?php  global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text"><b>Logged in as: </span> <?php print l($user->name,'user/'.$user->uid); ?> |
<?php print l("logout","logout"); ?>
<?php print $picture ?>
<?php else : ?>
<form action="user/login" method="post" id="user-login">
      <span class="login_text">Username:</span><span class="form-required" title="This field is required.">*</span>
      <input type="text" maxlength="60" name="name" id="edit-name"  size="5" value="" tabindex="1" class="form-text required" /></label>
      <label for="edit-pass"><span class="login_text">Password:</span><span class="form-required" title="This field is required.">*</span>
      <input type="password" maxlength="" name="pass" id="edit-pass"  size="5"  tabindex="2" class="form-text required" /></label>
      <input type="hidden" name="form_id" id="edit-user-login" value="user_login"  />
     <input type="submit" name="op" value="Log in"  tabindex="3" id="edit-submit" class="form-submit" /></form>
      <?php endif; ?>

I want to display the user profile image at the print l("logout","logout"); line,
With something like this:

     <?php
print theme('imagecache', 'user_image_default', $profuser->picture, $profuser->name, $profuser->name );
?>

But it outputs nothing.

Anybody know the solution?

Cheers.

Comments

prezaeis’s picture

try this

global $user;
if ($user->uid) {print theme("user_picture",$profileuser);}
  else {
    print '<img src="/'.variable_get('user_picture_default', '/noavatar.png').'" alt="Default User Picture" />';
  }
Gerlof’s picture

It works great :)