[WordPress] 外掛分享: Double Opt-In Helper

首頁外掛目錄 › Double Opt-In Helper
100+
安裝啟用
尚無評分
680 天前
最後更新
問題解決
WordPress 6.4+ PHP 7.4+ v1.0 上架:2021-12-09

內容簡介

Double Opt-In Helper 是一個 WordPress 外掛,可以幫助開發人員在他們的外掛中實現雙重確認程序。

什麼是雙重確認?

雙重確認是一種用於確認使用者同意的程序。現今,服務提供者需要在收集或使用使用者個人資料之前獲得明確的同意。然而,在某些情況下,要求使用者勾選「我同意」的核取方塊是不足夠的。在這些情況下,雙重確認發揮了有用的作用。

一個典型的雙重確認程序始於服務提供者向使用者發送電子郵件。該郵件中包含一個指向提供者網站的 URL 連結,要求使用者點擊該連結,以確定他們是否同意條款。通常,該 URL 包含某種類型的唯一隨機代碼,作為確認使用者同意的標誌。

這樣做,服務提供者可以確認真實的使用者(而不是機器人或其他人)已經同意,因為只有使用者才能夠訪問指向其電子郵件地址的消息。

我是開發人員,我如何使用這個外掛?

首先,要註冊一個「代理人」,以處理雙重確認會話並知道當使用者選擇加入時該做什麼。

要註冊代理,使用 doihelper_register_agent() 函數。 doihelper_register_agent() 接受兩個參數:代理人的名字(必填)和一個可選的關聯數組參數。可用的參數如下所示:

acceptance_period — 雙重確認會話保持活躍的時間長度(以秒為單位)。預設值:86400(24小時)
optin_callback — 當使用者選擇加入時將調用的回調函數。
email_callback — 用於發送確認電子郵件的回調函數。

完成代理註冊後,要通過調用 doihelper_start_session() 函數來啟動雙重確認會話。 doihelper_start_session() 接受兩個參數:代理人的名字(必填)和一個可選的關聯數組參數。可用的參數如下所示:

email_to — 接收確認電子郵件的收件人地址。如果省略此參數,將不會發送任何電子郵件。如果您未提供此參數,則需要以另一種方式向使用者提供確認鏈接。
properties — 會話的屬性數組。此數組將作為其唯一參數傳遞給 optin_callback 函數。雖然您可以將任何信息包含在內,但其主要目的是將與用戶相關的數據傳遞給加入回調。

會話數據將存儲在數據庫中,直到使用者選擇加入或接受期限(來自 doihelper_register_agent() 設置)過期。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Double Opt-In Helper」→ 直接安裝(推薦)

原文外掛簡介

Double Opt-In Helper is a WordPress plugin that helps developers implement the double opt-in process in their plugins.
What is double opt-in?
Double opt-in is a procedure used to confirm user’s consent. Today, service providers are required to obtain clear consent from users prior to collecting or using their personal data. In some situations, however, asking the user to tick an “I agree.” checkbox is not sufficient. Double opt-in serves a useful role in such situations.
A typical double opt-in process starts by the service provider sending an email message to the user. The message includes a URL link to the provider’s website and asks the user to click the link if they agree on conditions. Usually, the URL includes some sort of unique random code that works as a token to confirm the user’s consent.
By doing this, the service provider can confirm that the real user (not a bot or someone else) has consented, because only the user should be able to access messages to their email address.
I’m a developer. How can I use this plugin?
First, register an “agent” who can handle double opt-in sessions for you, and knows what to do when a user opts-in.
To register an agent, use the doihelper_register_agent() function. doihelper_register_agent() takes two parameters: the name of the agent (required), and an optional associative array of arguments. The available arguments are:

acceptance_period — The length of time (in seconds) for how long a double opt-in session remains live. Default value: 86400 (24 hours)
optin_callback — The callback function that will be called when a user opts-in.
email_callback — The callback function that will be called to send a confirmation email.

After registering an agent, start a double opt-in session by calling the doihelper_start_session() function. doihelper_start_session() takes two parameters: the name of the agent (required), and an optional associative array of arguments. The available arguments are:

email_to — The recipient’s email address, used for the confirmation email. If you omit this argument, no email will be sent. If you do not provide this argument, you will need to provide the user with the confirmation link another way.
properties — The properties array of the session. This array is to be passed to the optin_callback function as its only parameter. While you can include any information into this, the primary purpose of it is to pass user-related data to the opt-in callback.

The session data will be stored in the database until the user opts-in, or the acceptance period (from doihelper_register_agent()) expires.

延伸相關外掛

文章
Filter
Mastodon