When an anonymous user tries to access a chat page he/she gets 8 pairs of:

Notice: Undefined property: stdClass::$name em chatroom_chat_get_themed_message() (linha 1371 de E:\vhosts\gelpalhano.org\httpdocs\drupal\sites\all\modules\chatroom\chatroom.module).
Warning: strpos() [function.strpos]: Empty delimiter em chatroom_chat_get_themed_message() (linha 1371 de E:\vhosts\gelpalhano.org\httpdocs\drupal\sites\all\modules\chatroom\chatroom.module).

...
(14 more times)

Also, the anonymous user is able to see the messages from the authenticated user, but the opposite is not true. Not even the anonymous user's own messages are displayed in the chat messages box.

Any ideas what this has to do with?

My server is:
Windows, IIS 6.0, Drupal 7.2 (CTools 7.x-1.0-alpha4, Captcha 7.x-1.0-alpha3, Localization Update 7.x-1.0-beta2, Organic Groups 7.x-1.0 (disabled), Chatroom Nodejs integration 7.x-1.0-beta1 (disabled), Nice Menus 7.x-2.0, Views 7.x-3.0-beta3)

Cheers,

CommentFileSizeAuthor
#8 untitled.JPG21.91 KBzahari
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gumdrop’s picture

I got that happening on my Linux box as well. This maybe also a permissions issue. But I haven't tried that yet.

wolfmarter’s picture

I have the same problem and all i have installed is the chat module.
this means that anonymous users cant chat.

thx

wolfmarter

wolfmarter’s picture

There seems to be a problem with the permissions of the guest user but i can't put my finger on it. I will keep posting infos.
regards

wolfmarter

naoliva’s picture

Internal function variable $user->name was wrongly declared as $username on function chatroom_chat_get_themed_message (3 occurrances).
Change this on file chatroom.module and the warnings are eliminated but it does not correct the fact anonymous users cannot send messages. I am still investigating this.
I am completely new Drupal's user and I don't know if my answer is enough to alert module keepers.

Solution above has side-effects... investigating if keeping $username instead of $user->name in one ocurrence inside this function is enough. Forgive-me.

gumdrop’s picture

@naoliva that's ok we still love you :D

squidless’s picture

I was able to get it working by doing the following (all within the chatroom.module):

function chatroom_view($node, $view_mode) {
global $user;

// drupal doesn't save session data unless we actually set something
$_SESSION['chatroomdummy']='dummy'; // changed 11-12-11 bq

------------------------------------------

function chatroom_chat_view($node, $view_mode) {
global $user;

// drupal doesn't save session data unless we actually set something
$_SESSION['chatroomdummy']='dummy'; // changed 11-12-11 bq

------------------------------------------

function chatroom_chat_load_messages_helper($sql, $args) {
...
$result = db_select('chatroom_chat_online_list','c') // changed bq 11-12-11
->fields('c') // changed bq 11-12-11
->condition('sid', $guest_sids, 'IN')
->execute()
->fetchAll(PDO::FETCH_OBJ);

------------------------------------------

function chatroom_chat_get_latest_messages($node, $last_msg_id, $command_response = FALSE) {
...
if (!$cached_chat_user = chatroom_get_cached_user()) {
$offset="";
if (isset($user->chat_timezone_offset)) $offset=$user->chat_timezone_offset; // changed bq 11-12-11
else $offset=chatroom_get_user_timezone_offset(); // changed bq 11-12-11
$cached_chat_user = (object) array(
'uid' => $user->uid,
'allowed_chats' => array(),
'is_chat_admin' => $user->is_chat_admin,
'can_access_user_profiles' => $user->can_access_user_profiles,
'chat_timezone_offset' => $offset, // changed bq 11-12-11
);
}

Jesus Rodriguez’s picture

I've tried the solution above and did not work... would you upload the file so we can use it?

zahari’s picture

Issue tags: +chat, +chating, +zahari, +chating room
FileSize
21.91 KB

hi..i just debug it...
-------------------------------------------------------------------------------------------------------------

else {
$username = $message->name;
}
$public_css_class = variable_get('chatroom_msg_public_class', 'chatroom-msg');
$private_css_class = variable_get('chatroom_msg_private_class', 'chatroom-private');
$class = "new-message $public_css_class" . ($message->msg_type == 'private_message' ? " $private_css_class" : '');

/**
* wohaa... debug by zahari..
* if ($message->uid != $user->uid && (strpos(strtolower($message->msg), strtolower($user->name)) !== FALSE)) {
* $class .= ' chatroom-username';
* }
*/

$output = '

';
$output .= '(' . chatroom_get_message_time_string($message->modified) . ') ' . $username . ': ';
$output .= theme('chatroom_message', array('message' => $message, 'node' => $node));
$output .= "

";
return $output;
}
---------------------------------------------------------------------------------------------------------------

p/s:working? :)

eoto88’s picture

Working for me! Thanks!

else {
$username = $message->name;
}
$public_css_class = variable_get('chatroom_msg_public_class', 'chatroom-msg');
$private_css_class = variable_get('chatroom_msg_private_class', 'chatroom-private');
$class = "new-message $public_css_class" . ($message->msg_type == 'private_message' ? " $private_css_class" : '');

/**
* wohaa... debug by zahari..
* if ($message->uid != $user->uid && (strpos(strtolower($message->msg), strtolower($user->name)) !== FALSE)) {
* $class .= ' chatroom-username';
* }
*/

$output = '';
$output .= '(' . chatroom_get_message_time_string($message->modified) . ') ' . $username . ': ';
$output .= theme('chatroom_message', array('message' => $message, 'node' => $node));
$output .= "";
return $output;
}

Anonymous’s picture

Version: 7.x-1.0-beta1 » 7.x-2.x-dev
Status: Needs review » Active

please try the new 7.x-2.x branch.

apaderno’s picture

Issue summary: View changes
Issue tags: -chat, -chating, -zahari, -chating room