FastComments.com

Add Comments With Memberstack


結合 FastComments 與 Memberstack,我們可以設定僅限會員的專屬評論!


程式碼 Internal Link

我們可以透過一小段程式碼輕鬆地將 FastComments 與 Memberstack 連接起來:

FastComments Memberstack 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 window.$memberstackDom.getCurrentMember().then(({data: member}) => {
6 if (member) {
7 FastCommentsUI(document.getElementById('fastcomments-widget'), {
8 tenantId: "demo",
9 urlId: window.location.pathname,
10 simpleSSO: {
11 username: member.customFields.name || member.auth.email.replace(/@.+/, ''),
12 email: member.auth.email,
13 avatar: member.customFields.avatar
14 }
15 });
16 } else {
17 FastCommentsUI(document.getElementById('fastcomments-widget'), {
18 tenantId: "demo",
19 urlId: window.location.pathname,
20 simpleSSO: null
21 });
22 }
23 })
24</script>
25

當使用者透過 Memberstack 登入後訪問您的網站或應用程式時,他們將自動登入到 FastComments,其留言 將被標記為 Verified

如果未登入,他們也可以透過留下姓名和電子郵件來發表留言。

僅限會員留言

如果您希望實現僅限會員留言,請嘗試以下程式碼片段,但將 https://example.com/login 更改為您希望使用者點擊 Login 按鈕時跳轉的位置:

Exclusive FastComments Memberstack 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 window.$memberstackDom.getCurrentMember().then(({data: member}) => {
6 if (member) {
7 FastCommentsUI(document.getElementById('fastcomments-widget'), {
8 tenantId: "demo",
9 urlId: window.location.pathname,
10 simpleSSO: {
11 username: member.customFields.name || member.auth.email.replace(/@.+/, ''),
12 email: member.auth.email,
13 avatar: member.customFields.avatar
14 }
15 });
16 } else {
17 FastCommentsUI(document.getElementById('fastcomments-widget'), {
18 tenantId: "demo",
19 urlId: window.location.pathname,
20 simpleSSO: {
21 loginURL: 'https://example.com/login'
22 }
23 });
24 }
25 })
26</script>
27

自訂 Internal Link

FastComments 旨在進行自訂以匹配您的網站。

如果您想添加自訂樣式或調整配置,請查看我們的自訂文檔了解如何操作。