Thanks Darren and everyone else for all of your ongoing great work on this module. Great stuff!!
I was curious about the following use case.
I have an active chat room space on my site that I have affectionately called "The Lodge": www.ithou.org/chatrooms/chat/2
The "who's online" block works great for this page. However, I would also like to have this block show up on *other pages* to show who is chatting away in "The Lodge", in case someone who is *not* already on this page, sees that a friend is in "The Lodge" wants to join them. For example, I would like the "who's online" block for "The Lodge" to show up here: www.ithou.org/tracker/all
Currently, the only way the
chatroom_block_chat_online_list()
shows up is when you are actually viewing the page. Is there a way to create a custom block listing the people in "The Lodge, i.e., Chat#2" ... even when you're not on that page?
Thanks!
PS. I imagine you can do it via a hack to the
function chatroom_block_chat_online_list()
code, though I'm not quite sure what to mix and match. If I figure it out myself, I'll let people know... Best, Albert
Comments
Comment #1
ajwwong commentedComment #2
darren ohI wouldn't recommend using the chat_online_list block for this purpose. It is designed to show who's on-line in the chat on the current page. The reason it doesn't show on other pages is that it's empty, and Drupal doesn't display empty blocks. Instead, create a custom PHP code block, and paste in the code from theme_chatroom_block_chat_online_list(), except for the first four lines, which should be replaced with
$chat_id =followed by the ID of the chat whose members you want to show.Comment #3
ajwwong commentedAwesome... thanks for the tip, Darren! Appreciate it... I'll let you know how it goes... :-)
Comment #4
samuelet commentedI think that it'd be useful such a block.
I've tested this code on 5.x.1-9 but unfortunately it does not work on my site.
Each user can see only its own name in the block, but not the others and block is empty when user is not in the chat.
Comment #5
ajwwong commentedI'll just say, that I tried this out [or what I thought was an equivalent version in 4.7] and it didn't seem to work either... similar behavior as described in #4 above, but I was going to wait to make a full report on success/failure until I tried it out in drupal 5.
thanks samuelet for the heads up.
regards,
albert
ps happy thanksgiving everyone!
Comment #6
darren ohMy directions were incomplete. You need to add
chatroom_block_settings();to your code.
Comment #7
darren ohEquivalent instructions for 4.7:
chatroom_block_chat_online_list().matches = array([chat ID]);chatroom_block_add_state_js();Comment #8
ajwwong commentedThanks Darren! I really appreciate this... I'll try this out and let you know!
Blessings,
Albert
Comment #9
ajwwong commentedThis looks great and seems like exactly the right way to do it! Thanks, Darren.
I'm including my code here, in case anyone else looking wants it... [I'm still going to probably need to update to Drupal 5 in order to get this commit http://drupal.org/cvs?commit=72486 so that the list is updated when someone leaves the chatroom. But at least for now, I just wanted people to know that this is basically working!]
drupal 4.7
chatroom.module,v 1.50.2.50
Thanks, Darren!
Albert
Comment #10
ajwwong commentedJust FYI... I pasted in the patch for the commit from http://drupal.org/cvs?commit=72486 into the 4.7 version, to get the more frequent updates to the who's online block, and while the patch does its job on the actual chat page, e.g., www.ithou.org/chatrooms/chat/2... for the block on the "pointer" page www.ithou.org/tracker/all , it also shows the the person who has most recently exited the chatroom as remaining in the room.... interesting....
I'll keep researching this...
Thanks for your help!
Comment #11
samuelet commentedTo get it work on 5.x.1-9 i had to change:
into:
I think that this could lead to the problem that block list contains always the last user that left the chat:
Probably this should be fixed by the ajax calls of chatroom.js, but loading it with the following block code:
fails with this javascript error:
Comment #12
samuelet commentedThis block code fixes the problem with my above bug. Block is updated only when a page is loaded (no ajax) and it lists users that has updated their chat status in the last $offset seconds.
Comment #13
astra.satya commentedThanx for the code.
www.zenxcoder.com