How to be invisible on the Online Users block. A Moodle 1.9.x and 2.x solution.

3905

Learning Outcome: at the end of this post, you will know how to allow your Moodle 1.9 and 2.0 users to hide themselves on the Online Users block.

Post Pages - Post Inline - WIRIS

Now I don’t know about you, but I like, no, LOVE, the Online Users block by Andy J. Davis. It lends an air of Web 2.0 for Moodle. The feeling of a learning community that the block helps to foster is priceless. This block is useful for students and teachers to know who is online.

Figure 1: Online Users block.
A Moodle core block. And these names are very British.
Image source: http://docs.moodle.org/22/en/Online_Users_block
A teacher can gauge how many students are engaging themselves in night learning. Knowing who is online two hours before a quiz expires, can help students. They can contact and message each other or collaborate.

Two cases for invisibility. Why you should switch on the cloaking device.

 All this is well and good, but there can be cases where having the entire class see your avatar is not cool. Some teachers may not want to be seen online. You might be grading assignments online and would not want to be interrupted by an instant message, chat window or by an email by your students. This is a real possibility if you are blessed to be an effective teacher, one who is well-loved by your students. So how to stay focussed on that rubric or grading of online submissions when you are peppered with requests from students?

If you are a teacher for whom 24 hours is never enough time, the only time you might be updating your course materials is after office hours. To be specific, at night. To be realistic, past the midnight hour, when the spouse and the kids are asleep. So, you might not be comfortable being seen on-line by your students at an unholy hour.  So as a teacher, how do you feel about accessing your Moodle site in the wee hours of the morning, and to find that your students are just as hard-working as you, online on the site? For me, there’s always that funny feeling that the student might be on-line at the same time as I, and is wondering “Why is Mr. Frankie up late at night logged on to the Moodle site?”.

Figure 2: Star Trek
Kligons in Alpha Sector, Captain!
Turn on the Cloaking Device, Spock!
Source: d-greg.deviantart.com, Creative Commons Attribute.

Of course you can also set the block (Site Administration | Modules | Blocks | Online Users | Remove after inactivity) to display users who have been online for 120 minutes. So if students see your avatar, it might have been because you logged on at 12 midnight and logged off a 12:30am and are now fast asleep. Only problem is, if you and your student are still logged on at 3:00am, then the game’s up. You’ve been found out.

Some students may wish that they too were invisible in spite of that infernal online users block sitting pretty on the course page. A student may feel uncomfortable about revealing their presence to the world during the early hours of the morning.

So…?
So is there a way to make a user invisible to the Online Users block? I mean other than removing or hiding the block, is there a way to give a choice for the user to click a button and hey presto! Avatar disappears from the block. If Facebook allows you make yourself invisible on the Facebook chat window, why not apply the same concept to the Online Users block? We certainly can! To be exact, a user (teacher, student or administrator) can choose to allow his or her avatar and username to appear or be invisible on the Online Users block.

In this post, I present a practical and workable solution. I was the facilitator to this particular solution, and Mr. Matteo Scaramuccia of Genova Italy was the writer of the solution PHP code. Brilliant chap he is. So enough yacking around. Let’s roll up our virtual sleeves and get to work.

HOW TO – MOODLE 1.9

Step 1: Access the Create a User Profile field link.

Figure 3: Click on the User profile fields link.



Step 2: Create a new profile field

Figure 4: Choose Checkbox from the dropdown box.



Step 3: Type in the settings values.

Figure 5: Lots of settings. Take your time.

The short name will later be referenced in PHP code. The Name is what appears on the User’s edit profile page. Good to enter a brief and concise description. The “Display on signup page?” option should be set to “Yes”. Click the “Save changes” button when finished.

Return to your homepage. Click on your username. In my case, I have the Login & Logout block installed.

Figure 6: Let’s get to the user Profile page.

 

Scroll to the bottom of the page. See your custom, new user profile field description Stealth Mode? Great job so far! Tick the checkbox with your mouse and then click “Upate profile”. You’re halfway there!

Figure 7: Let’s get to the user Profile page.

Step 4: Modify MoodleSite/blocks/online_users/block_online_users.php

Go to line 108 of the file named block_online_users.php.
Comment off lines 108 to 114.
For the code and the rest of the article, read here >>