FastComments.com

Add Comments to LearnWorlds Courses and Pages

FastComments can be added to LearnWorlds in two places:

  • Course content, using an Embed learning activity in the course outline. LearnWorlds lists the Embed learning activity as available on the Trial, Starter, Pro Trainer, Learning Center, and High Volume & Corporate plans.
  • Site pages built with the LearnWorlds Site Builder, using an Embed section.

This tutorial requires a FastComments account. Sign in before copying the code snippets so that they contain your account's tenant ID. You can create an account here.

Step 1: Create an Embed Learning Activity Internal Link

Each comment area in a course is a separate Embed learning activity. Add one wherever learners should be able to comment:

  1. Open the Course Manager, find the course, and go to Course outline.
  2. Click Add activity and select Embed.
  3. Enter a title for the activity.
  4. Click Save and Edit.

If you clicked Save instead, hover over the new activity and click Settings to open the code field.

Step 2: Paste the FastComments Course Code Internal Link

Copy the following snippet. If the tenantId is demo, sign in to your FastComments account and reload this page so the snippet contains your tenant ID.

FastComments LearnWorlds Course Snippet
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 (function fcLoad() {
6 // Change this value for every Embed activity. Each value is a separate comment thread.
7 var threadId = 'my-course-activity-1';
8
9 function getPageWindow() {
10 try {
11 if (window.top.location.href) {
12 return window.top;
13 }
14 } catch (e) {}
15 return window;
16 }
17
18 function tryLoad() {
19 var container = document.getElementById('fastcomments-widget');
20 if (!container || !window.FastCommentsUI) {
21 return setTimeout(tryLoad, 500);
22 }
23 if (container.fastCommentsSetup) {
24 return;
25 }
26 var pageWindow = getPageWindow();
27 window.FastCommentsUI(container, {
28 tenantId: 'demo',
29 urlId: threadId,
30 url: pageWindow.location.href,
31 pageTitle: pageWindow.document.title
32 });
33 container.fastCommentsSetup = true;
34 }
35
36 tryLoad();
37 })();
38</script>
39

Before pasting, change the threadId value. The threadId value is passed to the widget as urlId, which identifies the comment thread. Use a different value for every Embed activity, for example intro-course-lesson-1. Two activities with the same value show the same comments. See URL ID for details.

Paste the snippet into the code field of the Embed learning activity and click Save.

The snippet reads the page address and title from the top-level browser window when it can, and from its own window otherwise. These values are stored with each comment and used for links in notifications and the moderation dashboard.

Step 3: Hide the Native Course Discussion Tab Internal Link

LearnWorlds courses can show a native Discussion tab in the course player. To show only FastComments in a course, turn the Discussion tab off for that course:

  1. Go to Courses & Programs and then Courses.
  2. Select the course.
  3. Go to Course settings and open Course Player.
  4. Disable the Show the course Discussion tab setting.

The course player setting applies to one course. School-wide course discussion settings are under Settings, School settings, Community access, in the Course Discussion section.

This step is optional. FastComments does not depend on the native Discussion tab being shown or hidden.

Step 1: Add an Embed Section Internal Link

To add comments to a page built with the LearnWorlds Site Builder:

  1. Go to Website, then Design, then Edit Website.
  2. Select the page to edit in the Page Manager.
  3. Hover over the page and click the (+) icon to add a section.
  4. Select the Embed category and click Add.
  5. Click the new element to open its settings in the sideform.

Step 2: Paste the FastComments Page Code Internal Link

Copy the following snippet. If the tenantId is demo, sign in to your FastComments account and reload this page so the snippet contains your tenant ID.

FastComments LearnWorlds Page Snippet
Copy Copy
1
2<script src="https://cdn.fastcomments.com/js/embed-v2.min.js"></script>
3<div id="fastcomments-widget"></div>
4<script>
5 (function fcLoad() {
6 function getPageWindow() {
7 try {
8 if (window.top.location.href) {
9 return window.top;
10 }
11 } catch (e) {}
12 return window;
13 }
14
15 function tryLoad() {
16 var container = document.getElementById('fastcomments-widget');
17 if (!container || !window.FastCommentsUI) {
18 return setTimeout(tryLoad, 500);
19 }
20 if (container.fastCommentsSetup) {
21 return;
22 }
23 var pageWindow = getPageWindow();
24 window.FastCommentsUI(container, {
25 tenantId: 'demo',
26 urlId: pageWindow.location.pathname,
27 url: pageWindow.location.href,
28 pageTitle: pageWindow.document.title
29 });
30 container.fastCommentsSetup = true;
31 }
32
33 tryLoad();
34 })();
35</script>
36

Then:

  1. Paste the snippet into the Embeddable script box in the sideform.
  2. Click Update.
  3. Click Save to save the page.

LearnWorlds renders embeds only after the page is updated or when previewing, so the comment area may not appear in the editor until then.

The snippet uses the page path as the urlId, so the same snippet can be pasted on multiple pages and each page gets its own comment thread.

Customization Internal Link

The widget's styling and behavior can be changed with custom CSS and configuration options.

See the Customization Documentation for the available options.