This question originated from and then was answered by Silvia Ines Borro, a MoodleMonthly reader. The question was:
I’ve got in my Online Users block , a list of users that are not really connected. How can I close their sessions?
Here’s her answer (which she found after troubleshooting):
To remove the users from the user block, open the mdl_user table you’ll find fields such as lastlogin…fill them with zero.
To remove the users from the user block that appears when you are in a course open mdl_lastaccess, and locate the user id and the course id and delete that record.
That being said, do be careful when editing any mdl_user table to ensure that you don’t accidentally delete or edit any crucial user data.