Moodle Forum Subscription change

When a user posts to a forum and unless they click otherwise they are then subscribed to that forum.  Many of our users don’t read that far down the page and then complain to me when they receive 100+ forum posts via email.

To stop this from happening I changed the default subscription option at the bottom of the forum reply page so that the default option is DO NOT receive copies of this forum by email. 

Here’s how to do it:

We need to change 2 lines of code in the file /mod/forum/post_forum.php (around line 47)


$options[0] = get_string(”subscribestop”, ”forum”);$options[1] = get_string(”subscribestart”, ”forum”);


$options[0] = get_string(”subscribestart”, ”forum”);$options[1] = get_string(”subscribestop”, ”forum”);

Now the user must select the subscribe option when replying to a forum if that is what they want to do.

Ban Moodle Messaging

Moodle messaging is a fantastic tool but it is often abused by our students here at college.  Students have been reported to spend too much time sending messages in class.  Often the male students spend time looking for female students to whom they can send a message to.

When a student receives an unwanted message they can report it by clicking a link.

This then gets emailed to me and I can remove messaging rights for the offending user.

To do this I created an extra field in the mdl_user table called message_ban.  I then added some code to the message pages in Moodle which checks againt the user ID and the message_ban field.  If the user is banned they can no longer use the messaging system and they are greeted with the following message.

Ban forum posting rights

Although it is possible to remove forum posting rights using roles in Moodle I needed a quick way to ban posting rights for a particular user and forum.

We use Moodle as a student intranet as well as a VLE.  On the student intranet we have a student forum where students can discuss almost anything.  Occasionally, some students abuse this and post inappropriate messages.  We required a way to ban re-offenders from posting to the student intranet forum but retain their posting rights for their course forums.

I made some changes to the mdl_user table in the database and added a field called forum_rights.
This field is an integer.  Then i made some core changes to the Moodle code so that when a forum loads it checks the course ID against the user ID and if the user is banned they can read the entries in the forum but can no longer post.

When a banned user tries to post an error box appears informing them of the ban.

Online Users Page

The Moodle bar provides a quick glance as to how many users are using Moodle at any point in time.  In order to extend this functionality we created an Online Users page which does exactly what it says on the tin.

It grabs a list of active users that have been using Moodle in the last 5 minutes.  It displays their name and a link to their profile.

When an administrator views this page they see a link to Moodle Detective, a loginas button, an edit profile button,  a message history button and an option to send the user a message.

This was originally created for Moodle 1.9 but now runs on 2+

Online Users Page

Online Users Page

Moodle Word Censorship

It was brought to my attention that when Moodle filters out a word found in the “bad words” list it in fact leaves the word in the alt text.  So moving your mouse over the word “Scunthorpe” produces some quite interesting results!!

The resolve this I edited the file filter/censor/filter.php

And around line 36 replace this code

$words[ ] = new filterobject($badword, ‘<span class=”censoredtext” title=”.$badword.”>’, ‘</span>’,

with this:

$words[ ] = new filterobject($badword, ‘<span class=”censoredtext” title=”Censored”>’, ‘</span>’,

The ALT text now reads the word “censored” rather than displaying the offending word you tried to remove in the first place.