Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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,
Comment | File | Size | Author |
---|---|---|---|
#8 | untitled.JPG | 21.91 KB | zahari |
Comments
Comment #1
gumdrop CreditAttribution: gumdrop commentedI got that happening on my Linux box as well. This maybe also a permissions issue. But I haven't tried that yet.
Comment #2
wolfmarter CreditAttribution: wolfmarter commentedI have the same problem and all i have installed is the chat module.
this means that anonymous users cant chat.
thx
wolfmarter
Comment #3
wolfmarter CreditAttribution: wolfmarter commentedThere 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
Comment #4
naoliva CreditAttribution: naoliva commentedInternal 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.
Comment #5
gumdrop CreditAttribution: gumdrop commented@naoliva that's ok we still love you :D
Comment #6
squidless CreditAttribution: squidless commentedI 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
);
}
Comment #7
Jesus Rodriguez CreditAttribution: Jesus Rodriguez commentedI've tried the solution above and did not work... would you upload the file so we can use it?
Comment #8
zahari CreditAttribution: zahari commentedhi..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? :)
Comment #9
eoto88 CreditAttribution: eoto88 commentedWorking for me! Thanks!
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedplease try the new 7.x-2.x branch.
Comment #11
apaderno