I would really love to see a realtime "who's online" block, dynamically updating itself with AJAX every couple of minutes/seconds etc.

Would have done this myself, but my AJAX skills = 0

Thanks
jacauc

CommentFileSizeAuthor
#4 ajaxwhoisonline.txt7.21 KBjacauc

Comments

Anonymous’s picture

yes, i'd like this as well, and i'm prepared to put some time in to implement it.

i'm working on a chatroom module, where it would be great to hook into the existing who is online block to enable starting chats.

jacauc’s picture

Excellent! :D
Very happy to hear i'm not the only one looking for this.
I used Joomla before and they had a module that does this... since I switched back to drupal, this is the only nicety I miss.

Crell’s picture

Version: 4.7.2 » x.y.z

I'd suggest the best way to do this is to make it possible for any arbitrary block to reload periodically. The contents of that block are then Ajax-requested in the background and plopped into the block div in place of the old content. That could potentially even be a contrib module that adds a "dynamically reload every X minutes" field to the block configure page via Forms API.

As I don't know much of anything of Drupal's Ajax functionality at the moment I can't be of much more help than that, but that's how I'd recommend implementing it. :-) It probably wouldn't even need to touch core; a contrib module could do it all.

jacauc’s picture

StatusFileSize
new7.21 KB

well... I had a look on google again to see if I could locate the mambo module again and have a look at how it was done...
Seems like that project has completely disappeared from the web.
Luckily I still had the files in an old backup on my server...

I'm just uploading this as an example of how it was done in mambo... might be useless... might be helpful... Defnitely worked well!

That module works with one php file (attached) and one XML file:

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="module" version="4.5.2">
        <name>AJAX Who's Online</name>
        <author>Richard Stupart</author>
        <creationDate>September 2005</creationDate>
        <copyright>(C) 2005 Red Ferret Web Solutions</copyright>
        <license>GNU/GPL</license>
        <authorEmail>richard@redferret.co.za</authorEmail>
        <authorUrl>http://redferret.co.za</authorUrl>
        <version>4.5.2</version>
        <description>The Who's Online module displays the number of anonymous (that is, Guest) users and Registered users, (those that are logged in) that are currently accessing the web site. This module is AJAX enabled to update these stats in realtime</description>
        <files>
                <filename module="mod_ajaxwhosonline">mod_ajaxwhosonline.php</filename>
        </files>
        <params>
          <param name="showmode" type="radio" default="0" label="Display" description="Select what shall be shown">
                <option value="0"># of Guests/Members&lt;br&gt;</option>
                <option value="1">Member Names&lt;br&gt;</option>
                <option value="2">Both</option>
          </param>
          <param name="nameformat" type="radio" default="0" label="User Names" description="Select the format for showing the names of currently online users">
                <option value="0">Show user names&lt;br&gt;</option>
                <option value="1">Show full (real) names&lt;br&gt;</option>
          </param>
          <param name="updatedelay" type="radio" default="1" label="Update Delay" description="Select the delay between refreshes of the who is online box">
                <option value="1">1 Second&lt;br&gt;</option>
                <option value="5">5 Seconds&lt;br&gt;</option>
                <option value="10">10 Seconds&lt;br&gt;</option>
                <option value="20">20 Seconds&lt;br&gt;</option>
                <option value="30">30 Seconds</option>
          </param>
          <param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="A suffix to be applied to the css class of the module (table.moduletable), this allows individual module styling" />
        </params>

Is this illegal to share this? It is under GPL after all..
If it is illegal or not encouraged to copy examples from other open source projects, I will remove this..

might be useful
Cheers
jacauc

jacauc’s picture

...Anyone else interested here?
This would be such a fun and useful module!

scroogie’s picture

Currently there is work in progress to upgrade the javascript stuff in Drupal. In future Drupal will integrate jQuery from jQuery.com. When the integration is done, I think it would be very easy to change the block to asynchronous updates.

Crell’s picture

Version: x.y.z » 6.x-dev
Status: Active » Closed (won't fix)

I think the jstools module package offers something like this. If it doesn't, that's where you'd want to do it, not in core. File a feature request with that module if necessary.

jacauc’s picture

Project: Drupal core » Javascript Tools
Version: 6.x-dev » master
Component: user system » Proposed new addition
Status: Closed (won't fix) » Active

Please see the request above.

nedjo’s picture

Status: Active » Fixed

Funny you should ask. I was working for the first time on loading blocks over the weekend. I've just sketched in and committed a first cut at how to ajax load blocks. It's working in trunk/head. More work needed, see issue http://drupal.org/node/118215. See block configuration for the option to automatically refresh (refresh is every five seconds).

Anonymous’s picture

Status: Fixed » Closed (fixed)
mehran007’s picture

thanks for sharing this code. Could you guys post a tutorial on how to install this. I want to install it on free php hosting site .Do you guys think it will work on php supported site or do i need any other thing installed on hosting server?Looking forward for a reply.Thanks