XS Controlling Presence from Moodle

Jump to: navigation, search

In schools with more than ~50 users, the Neighbourhood view gets too crowded to the point where it is not usable.

The recommended solution is enable a special mode that manages the 'neighborhood view' (which is technically the presence service) with the membership to courses within Moodle.

We call this mode of operation presencebycourse.

Before we start

  • Make sure you are using XS 0.6 or newer
  • Setup must be complete, and the FQDN of the machine must resolve correctly - you must be able to successfully ping `hostname -f`
  • Ensure XO can connect and register. You will need at least a couple of XOs registered to check that the process is working.
  • Ensure Browse.xo is at least version 101.

The ejabberdctl command is very useful to check the state of ejabberd, the program that runs the presence service on the XS. Below you can see an example where the 'Online' group is setup correctly (meaning that presencebycourse is off):

 # will show 'Online' exists
 $ejabberdctl srg-list-groups `hostname -f`
 # show the settings of the Online Shared Roster Group -
 $ ejabberdctl srg-get-info 'Online'  `hostname -f`
 name: "Online"
 displayed_groups: ["Online"]
 description: "Created_by_ejabberd_init"
 online_users: true


  1. The first XO to register (reboot) and visit moodle successfully gets some extra rights (is an 'admin' of sorts). So get an XO reg'd and visiting Moodle -- it will auto-authenticate into Moodle. Should see a 'site administration' block on the left.
  2. Create some courses (Site Administration->courses->Add/edit->Add new), assign teachers and students. In the (currently long and confusing) "new course" form, all you need to set is Full Name and Short Name. Please ignore every other option. You can add more courses & enrolments later. This link may help: http://docs.moodle.org/en/Enrolment#Manual_enrolment
  3. In 'Site Administration', go to Courses->Presence Service, and set presencebycourse to Yes.
  4. Within 10 minutes, issuing the same ejabberdctl queries as above should show that Online has been replaced by several SRGs -- one per course. Asking for the 'info' of those, will show you their membership.
  5. When you make the switch from one mode to the other on the XS side, the situation will be confusing for the XOs, so they will need to re-associate to the Access Point (so they re-query their group membership) before they see the changes.


  • All changes to the course membership take 5~10 minutes to appear in ejabberd on the XOs.
  • Some changes (change of mode, a new course) are only seen by XOs when they reconnect to the network.

You can now review the results:

  1. Wait 5 minutes. We are waiting for the Moodle cron run to execute - you can tail -f /var/log/moodle/cron.log to see it run.
  2. Ask ejabberd for its list of 'Shared Roster Groups' with ejabberdctl srg-list-groups `hostname -f`

. It will show a list that corresponds with the shortnames of the courses created in Moodle.