It would appear that the error message...
Notice: Undefined property: stdClass::$name in theme_chatroom_message_username() (line 852 of C:\inetpub\wwwroot\Stream\Drupal7\sites\all\modules\chatroom\chatroom.module).
shows when an anonymous user interacts with the chat, 1 notice received for every 1 anonymous chat comment.
It would appear that theme_chatroom_message_username() in chatroom.module is calling the function function drupal_anonymous_user() which returns some user info.. http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_...
The info returned however does not contain the username for which is required when building the $info array that is looking for $chat_user->name.
function theme_chatroom_message_username($variables) {
$chat_user = $variables['message']->uid ? user_load($variables['message']->uid) : drupal_anonymous_user();
$output = '<span class="chatroom-message-username">';
$info = array(
'account' => $chat_user,
'name' => $chat_user->name,
'extra' => '',
'link_path' => 'user/' . $chat_user->uid,
'link_options' => array(),
);
$output .= theme('username', $info);
$output .= '</span>';
return $output;
}
This works fine for signed in members but does not anonymous.
Comment | File | Size | Author |
---|---|---|---|
#2 | username_theme_error-1993674-2.patch | 794 bytes | glekli |
Comments
Comment #1
ancym CreditAttribution: ancym commented+1
Comment #2
glekli CreditAttribution: glekli commentedAttaching a patch to fix this. I think using format_username() is the proper solution here.
Comment #3
glekli CreditAttribution: glekli commentedComment #5
glekli CreditAttribution: glekli commented