Combining online users and people

Name

Lonely People Block

Module type

Patch

Author

Nicole Hansen, et al.

Released

2006

Maintained

Limited

Languages

Not applicable

Compliance

Patch file

Documentation

None

Errors

None

The People block contains a single link to the Participants list. The Online Users block shows people who have visited the course page recently. What if there was a way to combine these two related blocks? Well, there is, and it is another simple way to claim back more valuable screen real estate.

Getting ready

The Lonely People Block is not really a block (and it's not a dating service either), it involves a patch. In other words, you are replacing part of the standard Moodle code. This might sound dangerous, but it's really quite a simple change.

How to do it...

There are two ways to achieve this patch. The first is to copy the provided patch file over the existing Online Users block code.

On the Moodle Modules and plugins entry for this patch, instead of left-clicking to download the module code, right-click on the download link and save the file named block_online_users.php to your computer. This file will be copied to the /moodle/blocks/online_users/ directory, but before you copy the file, be sure to back up the block_online_users.php file that is already there (just in case).

The problem with overwriting the standard block code is that the patch file may not be up-to-date with changes in the standard Online Users block. Instead of overwriting the block code, you can make the following addition to the existing block_online_users.php file, just before the return statement at the bottom of the file. This is the only part of the patch that is needed. This addition has also been updated to abide by the current role identification method.

if(
$COURSE->id!=SITEID &&
has_capability('moodle/course:viewparticipants', $context)
) {
$this->content->text .=
'<div style="text-align:center;font-size:small">'.
'<a title="'.get_string('listofallpeople').'" href="http://.
$CFG->wwwroot.'/user/index.php?id='.
$this->instance->pageid.'">'.
'<img src="'.$CFG->pixpath.
'/i/users.gif" height="16" width="16" alt="'.
get_string('listofallpeople').
'" style="vertical-align:text-top" />&nbsp;'.
get_string('participants').'</a></div>';
}

With the block code changed, there are no configuration changes that need to be made. The Online Users block will appear as normal, with a link to the Participants list at the bottom. The only change you might like to make is to remove the People block, which is now redundant.

How to do it...

This patch is a simple change, but with screen real estate, sometimes every bit counts.

See also

  • YUI Menu block
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset