I know this has come up before but I don't seem to be able to find a relevent answer. I want to replace the default list of names in the 'New users' block with images of my users avatars (or default avatar if no avatar has been uploaded). I have copied the user_list function from user.module and placed it in my template.php file. replacing 'user_picture' instead of 'username'

function phptemplate_user_list($users, $title = NULL) {
  if (!empty($users)) {
    foreach ($users as $user) {
      $items[] = theme('user_picture', $user);
    }
  }
  return theme('item_list', $items, $title);
}

However, I am only getting the sites default avatar as every image, even though all users have custom avatars uplaoded. Why is this? I'm obviously using the wrong variable (user_picture) - but what should I be using. I can't find a list of user variables.

Also what should I name the 'new users' block tpl.php file, as I'd like to change the header also?

Thanks

Comments

unxposed’s picture

Did the confusing title put people off? Or is it just that nobody knows!?

Any help would be really appreciated!

amandawolfe’s picture

I ran into the same problem. Based on my super-basic knowledge, I think you *may* be looking for the account variable. But I came up with a significantly easier and more elegant solution: A custom Views block. If you're trying to do anything customized on your site at all, at some point you're probably going to decide to go ahead and install it--if not to solve this, then down the road. So I'd say go with Views, learn the UI which--once you understand what it does is simple enough and extremely powerful--and then make yourself a custom block in 10 minutes. :)

unxposed’s picture

Thanks for the response! This is perfect, I installed views 2 last night and can't believe how powerful it is. Really great. I love how I can create a users view which will give me a page with a list of users & details, and also a block of the users showing only images - what I percieved as 2 birds, with one very designer friendly stone. I just need to find a way of using imagecache to define avatars and I'm sorted... but that's another issue. : )

Thanks again.

amandawolfe’s picture

Oh I've got your fix on that too, actually! (I love feeling helpful!) I wanted my user images to be cropped exactly square for a number of design reasons. This is the module you need: http://drupal.org/project/imagecache_profiles

Unfortunately as you will see, there's no D6 version yet. If you follow this thread, (http://drupal.org/node/225816) you'll see that some lovely people have ported it and rolled a patch against that port. So I currently have it installed (even though it's not technically a released module) and had to do the patch against it to get some functionality to work (which I'd never done before but was easier than I thought--I'm a designer-type too, not a developer!) and it's working super-smooth for me so far. It's a little scary to be using basically a custom module, but it's working for me now and it solves all my problems, so I'm sticking to it!

Anyhow, if you're interested in that somewhat-sticky solution, just follow all the comments in that post and that should get you there.

HTH!

unxposed’s picture

Awesome thanks.

Yeah I read that but was very put off by the whole patch thing... I still can't get my head around it, as much as I read the relevent pages, but I'll give it a proper go later and probably crack it.

Thanks again for your help!