I am looking for the user id of the person who wrote the message? I am trying to print the user avatar by each message

$output .= $variables['picture'] = theme('user_picture', $user); butttttt $user isn't right its just print my avatar for everyone.... any idea what to replace user with I have tryed everything...

Comments

Anonymous’s picture

can you give me more details? messages in most places in the code have $message->uid set to the uid of the author who wrote the message, so you probably need something like:

$output .= $variables['picture'] = theme('user_picture', user_load($message->uid));

note this could get expensive very quickly.

giorgio79’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Issue summary: View changes

Why is it expensive? :) Would be nice to style the chat after the smartphone chat apps that show a rounded user avatar :)

giorgio79’s picture

Title: Within the chat window how can I » Show avatars in chat instead of printed name
glekli’s picture

Status: Active » Closed (duplicate)

There is a pending patch for this in #2160777: support for user picture field.
Could you please check that out and see if this is what you needed? I'll close this as duplicate.