Thursday, August 23, 2012

Reward students for forum posts of N number of words or more with the Verbosity mod for Moodle 1.9!

The Verbosity mod for Moodle 1.9 was written by Paweł Suwiński of Poland in January 2012. This is so far the only mod that I know that awards a Moodle Gradebook score to a student based on forum posts made by the student. 
Figure 0. I write, therefore I am.

Learning Outcome
  • At the end of this post, you will know how to use Verbosity to award scores based on the quantity of forum posts made by a student for a specific forum. 
  • You will also know how to customise Verbosity so that only the  student who puts in some effort to type words and paragraphs in a forum post will have a score. For example, students who write 200-word posts will, deservedly, be rewarded. On the other hand, students who type, for example, five word sentences will not have any score in their Moodle Gradebook. Well that's the gist of it.
Figure 1. A typical Moodle forum

Note: to know how to add a word count data 
to a forum post, see my other post here.

Pedagogical Benefit of the Verbosity mod
Students will be motivated to participate more in a forum and will spend more time thinking about and crafting a forum post because of the grading criteria (either by count of forum posts - default mode, or my word count of a forum post - hack mode).

How Verbosity works
Figure 2. Verbosity out-of-the-box (default) rewards
students based on the NUMBER OF POSTS in a particular forum.

In its normal form, it allows you to inform your students that you will award them a score in their Moodl e Gradebook if they post in a Moodle forum. That score will be 100% for the student with the most number of posts. If Andy posts four times in a forum, and Beryl posts twice in the same forum, then Andy gets a 100% score and Beryl will get 50% in her Gradebook. You can also set it so that it only processes ratings-only forums.

In  Paweł 's own words in this forum:
"For example we use verbosity module with accumulative forum rating with scale -1:'Bad',1:'Good' (improved forum rating with negative points and absolute sum agregation and numbered user scales with labels). It works in that way, an example: I wrote 7posts, and users gave me 5x"Good" and 2x"Bad" rates. My total ammount of points for this forum is 10poins (real grade)- 7points from verbosity just for posting as quatitaive grade and 5-2=3 from improved forum rating as a quality grade. Let assume that only 3 users have posted on the forum and theirs totals (real grades) are: 5, 8, 10(me) points, so then theirs percentage grades looks as follow: 50%, 80%, 100%"

This is the normal way Verbosity works. Back in April 2012, I was intrigued by it and I realised its pedagogical value. It had the potential to motivate students to post in a Moodle forum and to be rewarded with a score.
Figure 3. A manual Gradebook. This reminds me of a true incident.
A visiting Professor once asked me "Do you have a notebook?".
I replied, "The paper version or the laptop type?".
She replied "The laptop type".

A little problem
I did also realise however, that the quantity of posts made by a student can be a deceptive factor. For example, if Andy in my example above, were to make four posts, with each post consisting of just two words: "Hi there!", Verbosity would still award 100% to Andy. Beryl could have made two posts but with a combined word count of 400 words, and she still would be awarded with 50% in her Gradebook. How unfair! Is this just?

Making Verbosity give grades based on word counts
WHAT IF there was a way for Verbosity to award marks based on the word count of a forum post made by a student?

If this were possible, then this would allow the teacher to bold proclaim to the class: "Okay class, I will give a 100% score to the student who has made the most number of forum posts in the History Forum on Word War II, provided each post consists of more than two hundred words". Imagine the effect that would have! Students would have to work harder to earn a well-deserved grade. Of course you would still have to manually check or read their posts since a post could consist of a 200-word paragraph of gibberish. An unlikely scenario? Unlikely, yes, but possible.

In April 2012 I tried  to contact Paweł Suwiński through All attempts to contact the author of the mod failed. With no one else to turn to, I set out to modify (hack) the Verbosity mod. I looked at the code and saw stars. I gave up the project and turned my attention to other pressing work.

Four months on, I felt moved to revisit this little project. Today I sent Paweł an E-mail, and this time, to my great joy, he replied by E-mail with an answer. He provided the diff file information for the hack to work. This Moodurian post is the result of the information that he passed to me.

Installation Steps
1. Download the Verbosity mod from here.

2. Extract the contents and upload the folder verbosity to your server's mod folder.

3. If you want to use Verbosity as it is (default out-of-the-box behaviour), then ignore this Step #3. Skip straight to Step#4. Otherwise, to adapt Verbosity so that it will add to the student's grade score ONLY IF a message posted by the student contains N number of words, edit the mod/verbosity/lib.php, do the following:

3.1 Insert the code:

    if(isset($CFG->verbosity_nwords_regexp)) {
        $sql .= ' AND p.message regexp \''.$CFG->verbosity_nwords_regexp.'\'';

at line 412 of mod/verbosity/lib.php, just above the line of code that reads: if(!is_null($verbosityid)) {
You can also refer to the diff code below for an exact picture.

Index: mod/verbosity/lib.php
--- mod/verbosity/lib.php       (wersja 72)
+++ mod/verbosity/lib.php       (kopia robocza)
@@ -412,6 +412,10 @@

+    if(isset($CFG->verbosity_nwords_regexp)) {
+        $sql .= ' AND p.message regexp \''.$CFG->verbosity_nwords_regexp.'\'';
+    }
     if(!is_null($verbosityid)) {
         $sql .= ' AND = '.$verbosityid;

3.2. Edit the config.php file (found inside the moodle root dir) and add this line of code:

                    $CFG->verbosity_nwords_regexp = '^[^ ]+( [^ ]+){199,}$';

For example, here's what my config.php file looks like after inserting the new $CFG code.

Figure 4. Inserting the hack code inside the config.php file.
Note that I blurred, rotated and mirror-imaged all the sensitive data. Heh.

You can also download the 'hacked' lib.php file from here. No, I'm not going to give you my config.php file!

4. Go to Site Administration and Notifications to install the mod into your Moodle system.
5. Make sure that you already have a forum setup.
6. Add an activity and choose Verbosity from the drop-down list

Figure 5. Add a Verbosity activity to my Moodle coursepage.
Gee, that's a pretty long list of third party mods you've got there partner!

7. Add the data inside the Verbosity form.

Figure 6. Verbosity Mission Control Centre.

Make sure you pick a live forum where there is some activity. In the example above, I have chosen a forum named "Forum: IT and You".

8. Click the "Save and display" button to continue.

Figure 7. Feedback from the activity.

9. Click the "View the grader report" to see the scores that have been awarded into the Gradebook. From the example below, you can see that James Dean has been given a score of 2.00 which is the result of having made two forum posts where each post contains more than 200 words. The other student, Mr. X, has made one forum post of 200 words or more, and is rewarded with a 1.00 score.

Figure 8. The hack code alters verbosity's default behaviour.
Now it awards scores only for posts which are more than 200 words.
I'm making my students work hard for the money.

10. To test the system futher, try logging in as the students and view the students' Grades. From the example below, James Dean's grade for the Verbo1 Verbosity activity (which is linked to the forum "IT and you") is 100%.

Figure 9. The top poster (who slogged hard to come up with 200++ word posts)
gets her just reward - a 100% score for the Forum-verbosity alliance.

And  Mr. X scored a grade of 50%.

Figure 10. The runnerup poster (who slogged slightly less harder to come up with 200++ word posts)
gets his just reward too - a 50% score for the Forum-verbosity alliance. Why 50%? It's because he
made one 200-word post, compared to the four 200-word post by the winner. Get it?

So that's how to use Verbosity. Here's wishing that you will find Paweł Suwiński's Verbosity mod a useful arsenal in your Moodle production site.

Happy Moodling
Frankie Kam

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!

Ratings and Recommendations by outbrain