Pages

Wednesday, February 6, 2013

Liven up the Participants List (People Block) in Moodle 2.4 by changing the City field into Hobby

How would you like to have a Hobby field show up in the Participants List in Moodle 2? Well it can be done! Charles Kelly of http://www.manythings.org had shown how it could be done in Moodle 1.9  here. The purpose of my blog post today, is to show you how to do it for your Moodle 2.x (tested on 2.4) site. I had previously blogged about doing the hack for Moodle 1.9 post here. The good news is that it's easier to do this for Moodle 2.x.
What’s the benefit of doing this? In my humble opinion, knowing that you come from Wellington or Kuantan is not as interesting as knowing that you have a liking for Psy, Bradfort City Football Club or rearing Beagle pups. How can we do this? In Moodle 2.x, you just need to do one mandatory step.
  • Firstly, change the City field’s display name to “Hobby / Interest / Free Time”.
  • Secondly (this step is optional), modify the length of City field from an already generous 120 characters to N characters.
Figure 1. What the Participants List looks like. Note that some users had earlier typed their City data since I only recently implemented the hack.

 Figure 2. Editing your User profile.
 Figure 3. what the Participants’ List looks like with ALL hobby data filled in my students. Nice, eh?
Like what you see? What do you think? Do you think that a Hobby data field makes the Participants list more interesting? Personally, I feel that if everyone were to be truthful and open to show others their hobbies, then the online community of your course page will get to know each other better. And that makes for a fun experience for your students.
Here’s how you can substitute the mundane City data field for a more Web 2.0-ish Hobby / Interest / Free Time data field:
Phase 1
First, we will need to change the display from the default “City” to “Hobby” something or other. For that, we have Charles Kelly to thank for! Please head over to:
http://www.manythings.org/tesl/moodle/index.php?n=Hacks.HowToGetMoodleToSubstituteHobbyForCity
These following instructions are mainly from Charles Kelly’s webpage, albeit updated for Moodle 2.4.
Add the following to the end of the file /lang/en/moodle.php, just before the closing tag   ?>
// Hobby Instead of City CK 2007-03-29
 $string['city'] = 'Hobby / Interest / Free Time';
 $string['location'] = 'Hobby / Interest';
 $string['missingcity'] = 'What do you do in your free time?';
 // END OF Hobby Instead of City CK 2007-03-29
So far, that was easy enough, wasn’t it?

Phase 2
In Moodle 2.4,  the database’s City field is a default 100 or 120 characters. So there is no real need to expand the character data field, is there?
 ;-)
If, however, there is a need to increase the limit manually, you will need to alter the 'City' maximum length several files and the database table, which makes maintainability over upgrades a challenge.
Edit these files at the line numbers indicated to allow for 100 chars in the city field:
 \login\signup_form.php - line 79
 \user\editlib.php - line 219
 \lib\moodlelib.php -line 3955
 You may also need to increase the database field mdl_user.city from 120 to N characters.
After you have done the micro-surgery hack on your Moodle 2.4 core files, try editing your User Profile. You will notice that the 'City' name has already been changed to 'Hobby / Interest / Free Time'. Proceed to type in your hobby. Then save your profile. You will notice the change like so in your profile data.
In additio,  apply the People Block on your Moodle 2.4 site.
Clicking on the Participants list will bring up something like this:
Make sure you inform your students of the People block and get them to click on it. Watch the fun as they relate to each other and get to know one another's interests and hobbies. That's it for now.
Regards 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!

2 comments:

  1. Did the high jump in school, but have never bungee jumped. Should write a will first I would think.

    ReplyDelete

Ratings and Recommendations by outbrain