Moodle – Online user campus location and graph

My online users page is proving to be very popular amongst our students, the page receives almost 4800 visits each week. 

Based on this popularity I decided to improve the page and add even more functionality.

Moodle captures the last ip address of each user and this is how we determine their campus location.

Our network is linked across many campus sites, and each site has it’s own IP range.  By creating an array to store the locations I was able to determine where the user is accessing Moodle from via a simple PHP script.

Adding visuals

I then needed a way to view the online users at a glance and see all user locations.  To do this is simply created total values for each campus and displayed them using a graph.