Chat Console Block

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Chat Console Block.


The Chat Console block is a convenience method of communication between users. Designed to be similar to a standard Gmail/Facebook chat, this block will show connected users a list of all other users who are currently connected to the site. When clicking on the name of another user, a chat area will pop up and the users will be able to communicate.


Download and Installation


The global settings for this block are these:

  • Remove after inactivity - If a user is inactive for this period of time he will be removed from the list.
  • Highlight color - The color used to highlight the names in the block. The color name should be entered here in standard color name format (e.g. lightgreen).
  • Send to history period - Periodically the chats are sent to history. You decide the period here. When the chat is sent to history you no longer see it in the chat area.

Tweaks, Tips and Tricks


Since appearance is largely subjective, configuration features like location were not included in the global settings of the block. If nonetheless you are interested in changing the default location of the chat area, it can be done quite easily through the code.

What you need to do is this: In the Console.js.php file in the function Open_Div_Chat, enter the default height from the bottom instead of 0 in the line which looks like this:

   chat_obj[num_chats] = 0;

Setting the distance from the horizontal edge of the screen is just a little more complex. In the same function you must change the 20 in the following line:

   left = 20 + (curr_chat*310);

but you must also change in the function Close_Div_Chat the 20 in the line:

       left = 20 + (i*310);

That is all. You change those numbers as you need and you can overcome problems like a Moodlebar blocking your chat area.

Turning Pages

There is an interesting feature in Moodle that can slightly inconvenience your chat experience. Since every time you enter a page it loads a new page you will find that you will lose your chat in such cases (which tend to be rather abundant). There is no direct way to confront this problem yet, but there are two things that must be taken into account:

1. Use site-wide blocks: If you confine your chat to a small area in your site, your users will be much more greatly inconvenienced because they will lose their chat as soon as they leave the chat "region".

2. Ignore the problem: As long as one side continues to chat, the chat area will open automatically for the other side if it happens to have closed as soon as he re-enters a chat "region" and a message has been sent to him.

At present the solution is mainly psychological, but we hope to find a better one soon.