I have a discourse forum, and I noticed that there is only 2 groups; admin and moderator. Can I add more groups and make them listed on the About us page?
Our Admins
Our Moderators
Our Trainees
Our Interns
Etc. Etc.
A user asks how to add more groups, such as ‘Trainees’ and ‘Interns’, to the ‘About Us’ page in a Discourse forum. awesomerobot explains that while there’s no direct setting, it can be achieved via a theme customization. They provide a code snippet to add custom groups using JavaScript and Handlebars, including steps to modify the code for additional groups. The solution involves adding group names to the script and duplicating the section for each new group, adjusting the title and group name accordingly.
I have a discourse forum, and I noticed that there is only 2 groups; admin and moderator. Can I add more groups and make them listed on the About us page?
Our Admins
Our Moderators
Our Trainees
Our Interns
Etc. Etc.
There isn’t a setting you can change to do this, but it’s possible in a theme.
Add this to admin > customize > themes > edit CSS/HTML > common > head
<script type="text/discourse-plugin" version="0.8">
const ajax = require('discourse/lib/ajax').ajax;
api.registerConnectorClass('about-after-moderators', 'custom-group', {
setupComponent(args, component) {
var groups = ["trainees", "interns"]; // Add group names here
groups.forEach(function(group) {
ajax("/groups/" + group + "/members.json").then (function(result){
var groupMembers = [];
result.members.forEach(function(members){
groupMembers.push(members);
});
component.set(group, groupMembers);
});
});
}
});
</script>
<script type="text/x-handlebars" data-template-name="/connectors/about-after-moderators/custom-group">
<!-- Duplicate me -->
<section class='about custom'>
<h3>{{d-icon "users"}} Our Trainees</h3> <!-- Change icon and title -->
<div class='users'>
{{#each trainees as |u|}} <!-- change group name here -->
{{user-info user=u}}
{{/each}}
</div>
</section>
<!-- duplicate end -->
<section class='about custom'>
<h3>{{d-icon "users"}} Our Interns</h3> <!-- Change icon and title -->
<div class='users'>
{{#each interns as |u|}} <!-- change group name here -->
{{user-info user=u}}
{{/each}}
</div>
</section>
<!-- Add more groups here -->
</script>
If you want to add more groups:
// Add group names here and then duplicate one of the sections<!-- Duplicate me -->