{"id":201,"date":"2022-10-28T22:38:35","date_gmt":"2022-10-28T11:38:35","guid":{"rendered":"http:\/\/localhost:10138\/?p=201"},"modified":"2023-08-17T10:55:40","modified_gmt":"2023-08-17T00:55:40","slug":"seminar-events-filter-totara-lms","status":"publish","type":"post","link":"https:\/\/dev-train-well.pantheonsite.io\/seminar-events-filter-totara-lms\/","title":{"rendered":"Seminar Events \u2013 Filter by location in Totara LMS"},"content":{"rendered":"\n

Do you need a simple filter to show\/hide seminar events from a selected location in Totara LMS?<\/p>\n\n\n\n

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).<\/p>\n\n\n\n

\"Demo<\/a>
A dynamic Site filter allows users to view events just for the selected location<\/figcaption><\/figure>\n\n\n\n

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

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

    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<\/mark><\/a>
    This code works in Totara LMS v12.<\/p>\n\n\n\n

    Click here to see a demo on Code Pen<\/u><\/a><\/p><\/blockquote>\n\n\n\n

    Steps to enable this dropdown to filter events by location<\/h2>\n\n\n\n

    There are just 3 steps to enable this locations filter:<\/p>\n\n\n\n

    1. Add a Site <\/strong>custom field to store the event location.<\/li>
    2. Create the events (including Site location).<\/li>
    3. Add the script to enable the dynamic filter.<\/li><\/ol>\n\n\n\n

      1. Add a Site custom field to store the event location<\/h3>\n\n\n\n

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

      \n
      \"The<\/a>
      The Seminars Custom Fields page<\/figcaption><\/figure><\/div>\n\n\n

      Refer to Creating custom fields – Totara Help 13 – Totara Help (totaralearning.com)<\/a><\/p>\n\n\n\n

      2. Create the events (including Site location)<\/h3>\n\n\n\n

      When adding the event to your seminar, trainers can select the Site <\/strong>from the Custom Fields section. Refer to Seminar events – Totara Help 13 – Totara Help (totaralearning.com)<\/a><\/p>\n\n\n

      \n
      \"Choose<\/a><\/figure><\/div>\n\n\n

      3. Add the script to enable the filter<\/h3>\n\n\n\n

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

      codepen.io\/vj\/<\/a><\/p>

      <\/p><\/blockquote>\n\n\n

      \n
      \"Codepen<\/a>
      Only copy the JS code.<\/figcaption><\/figure><\/div>\n\n\n

      Note:<\/strong> 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<\/a><\/p>\n\n\n\n

      That’s it!<\/p>\n\n\n\n

      I hope you found this useful!<\/p>\n\n\n\n

      Please comment and share your own thoughts<\/a> on this technique…<\/p>\n","protected":false},"excerpt":{"rendered":"

      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… … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":203,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"_links":{"self":[{"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/posts\/201"}],"collection":[{"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/comments?post=201"}],"version-history":[{"count":2,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/posts\/201\/revisions\/207"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/media\/203"}],"wp:attachment":[{"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/media?parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/categories?post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev-train-well.pantheonsite.io\/wp-json\/wp\/v2\/tags?post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}