Auto select single group membership type

From UnionCloud Support
Revision as of 09:40, 16 December 2016 by Orry Verducci (talk | contribs) (Page creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When a student joins a group, they have to select a membership type for the group. When there is only a single membership type for the group, the platform still requires the student to select it.

The following code snippet, which should be put in Global Javascript, will automatically select the membership type if there is only one membership type listed on the page.

$(function() {
    if (window.location.pathname.substring(window.location.pathname.length - 5) == '/join' || window.location.pathname.substring(window.location.pathname.length - 5) == 'join/') {
        if ($('.memberShipType').length == 1) {
        	$('.memberShipType').click();
        }
    }
});