Seminar Events – Filter by location in Totara LMS

Do you need a simple filter to show/hide seminar events from a selected location in Totara LMS?

We needed to run multiple events across multiple locations for our courses and we needed to do so across more than 50 different office locations. Since there may be 200 to 300 events every year for each course… we realised that it would be handy for the learners and admins to be able to filter by location (or the default Room).

Demo of the dynamic Site filter showing that it allows users to view events just for the selected location
A dynamic Site filter allows users to view events just for the selected location

As illustrated by the image above, it is possible to create a dynamic dropdown to filter Upcoming Events by Site (a custom Event field) by adding some code. We want to:

  1. Hide all events on load.
  2. Display a dynamically generated Site: Choose location dropdown.
  3. Show all scheduled events when ‘All locations’ is selected.
  4. Only show upcoming events for a location that is chosen (i.e. if scheduled).
  5. The previous events list is not modified.
  6. We can continue to use the Rooms Location feature to specify specific rooms.

I am a Learning Management System (LMS) Administrator and I first published this post at https://www.linkedin.com/pulse/seminar-events-filter-location-totara-lms-vijay-rudraraju
This code works in Totara LMS v12.

Click here to see a demo on Code Pen

Steps to enable this dropdown to filter events by location

There are just 3 steps to enable this locations filter:

  1. Add a Site custom field to store the event location.
  2. Create the events (including Site location).
  3. Add the script to enable the dynamic filter.

1. Add a Site custom field to store the event location

Go to Site administration > Seminars > Custom fields (/mod/facetoface/customfields.php?prefix=facetofacesession) and create a custom field called Site to capture the location. I decided to use a choice field (you can make it a required field).

The Seminars Custom Fields page showing the Site custom filed on the Event tab.
The Seminars Custom Fields page

Refer to Creating custom fields – Totara Help 13 – Totara Help (totaralearning.com)

2. Create the events (including Site location)

When adding the event to your seminar, trainers can select the Site from the Custom Fields section. Refer to Seminar events – Totara Help 13 – Totara Help (totaralearning.com)

Choose the Site location from the custom fields section when adding or editing seminar events

3. Add the script to enable the filter

Add the JavaScript (JS) code provided for you on my codepen to your site or course within <script> </script> tags.

codepen.io/vj/

Codepen editor with JS tab showing the JavaScript that you need to copy
Only copy the JS code.

Note: You can add the code sitewide across LMS via /admin/settings.php?section=additionalhtml to activate this filter on all seminar events or load it for an individual course via HTML block. Refer to my post on How to add code to enhance Totara LMS on LinkedIn

That’s it!

I hope you found this useful!

Please comment and share your own thoughts on this technique…

LMS Consultant

VJ - Vijay Rudraraju

Vijay Rudraraju (VJ)

I am a passionate Learning Management Systems (LMS) Administrator with 10+ years experience in administering learning systems, teaching, motivating, and directing learners. I am an experienced professional with a background in devising easy-to-use solutions for improved efficiency. 

I publish articles and tips in managing LMS, building eLearning packages, project management and data analysis and reporting.

Let's chat

Have a question? Comment below!

Feedback is awesome too.