

    // Show edit modal for user groups
    function editUserGroups(){
      id = "{{ page_user_id }}"

      //Retrieve the current groups for the user
      $.get("{{ url_for('api') }}/users/get_user", { id: id,}, function (data) {
        data = data.metadata        
        user_groups = data.groups
        $('#idUserGroupsEditInput').val(data.id);

        //Populate the Groups dropdown in the modal form
        $.getJSON("{{ url_for('api') }}/groups/list_groups", function (data) {
          groups = 