How would you like to have a Hobby field show up in the Participants List in Moodle 1.9? Well it can be done! Charles Kelly of http://www.manythings.org has done it in his post here. The purpose of my blog post today, is to show you how to do it for your Moodle site.

Post Pages - Post Inline - WIRIS

What’s the benefit of doing this? In my humble opinion, knowing that you come from Melaka or Kansas City is not as interesting as knowing that you have a liking for Pink Floyd, Manchester City Football Club or body building. How can we do this? Two steps.

  • Firstly, change the City field’s display name to “Hobby / Interest / Free Time”.
  • Secondly, modify the length of City field from a measly 20 characters to a generous 100 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 from Charles Kelly’s webpage.

Add the following to the end of the file /lang/en_utf8, just before the ?>

// 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

That was easy enough, wasn’t it?

Phase 2

Next, we will need to expand the database’s City field from the default and stingy 20 characters to a generous 100 character data field. The below link is most helpful. Especially the attached text patch file. Go to: http://tracker.moodle.org/browse/MDL-19629
Don’t faint, it’s easier than you think. 😉

While it is easy to increase the limit manually, it requires altering several files and the database table, which makes maintainability over upgrades a challenge. To make the change, some minor surgery is required.
Edit these files at the line numbers indicated to allow for 100 chars in the city field:

 \login\signup_form.php - line 51
 \user\editlib.php - line 196
 \admin\uploaduser_form.php - line 195
 \lib\moodlelib.php -line 2998
 You also need to increase the database field mdl_user.city from 20 to 100 characters using phpMyAdmin.

Have fun doing the micro-surgery hack on your Moodle 1.9.x core files.  In the meantime, check out Moodle 2.3. She’s getting better and better.

Regards
Frankie Kam

Previous articleMoodle Cheating Scandal in NY
Next articleIn the words of one Moodler, “Moodle 2.3, simply awesome”

4 COMMENTS

  1. Hi Dan
    Thanks for sharing a more portable method of changing the string values in Moodle. That will come in handy when upgrading to a newer version of Moodle. The hack shared above tends to add to an administration nightmare for the Moodle administrator who has to keep track of all the code changes. One question, does the language customisation admin tool allow you to change the string length of a field?

Comments are closed.