[WordPress] 外掛分享: WP Bouncer – Limit Simultaneous Logins

首頁外掛目錄 › WP Bouncer – Limit Simultaneous Logins
WordPress 外掛 WP Bouncer – Limit Simultaneous Logins 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
4,000+
安裝啟用
★★★☆☆
3.9/5 分(10 則評價)
727 天前
最後更新
問題解決
WordPress 5.2+ v1.5.1 上架:2013-07-27

內容簡介

WP Bouncer 可限制相同 WordPress 使用者帳戶的同時登入數量。該外掛程式的目標是防止使用者分享您網站的登入憑證,這對於付費會員、高級內容或電子學習網站尤其重要。

WP Bouncer 如何保護共享使用者登入?

該外掛程式為每個使用者在登入時存儲一個隨機的 FAKESESSID。
如果使用者已登入,WP Bouncer 在每個頁面載入(init hook)時檢查使用者 cookie 中存儲的 FAKESESSID 是否與快取(fakesessid_user_login)中存儲的上次登入相同。
如果兩個值不匹配,WP Bouncer 會將使用者登出並將其重定向到 WordPress 登入頁面或使用 wp_bouncer_redirect_url 過濾器自定義頁面。

如果定義 WP_BOUNCER_HEARTBEAT_CHECK 為 true,就會加載 JavaScript 以在新使用者使用相同的登入時彈出該使用者。這對具有頁面緩存的站點很有用。

管理員帳戶或任何具有“manage_options”功能的使用者皆不會被到處踢出。

或者,允許特定數量的活動會話

WP Bouncer 預設只允許每個使用者一個會話。您可以使用此外掛程式通過共享登入為企業、教育或其他類型的群體客戶提供批量會員身份。使用 wp_bouncer_number_simultaneous_logins 過濾器來允許指定數量的活躍“會話”。

範例使用情境:

使用者 A 以“user”身份登錄。他們的 FAKESESSID(假 ID)存儲在 WordPress 選項中。
使用者 B 以“user”身份登錄。他們的 FAKESESSID 替換之前存儲的 WordPress 選項。
使用者 A 嘗試在您的網站上加載頁面,WP Bouncer 抓到並登出他們,將其重新導向到警告訊息。
使用者 B 可以正常瀏覽網站...除非...
使用者 A 再次以“user”身份登錄。他們的 FAKESESSID(假 ID)“SESSION_A_v2” 存儲在 WordPress 選項中。
現在,如果再次加載頁面,使用者 B 將登出。

托鉤和過濾器:

wp_bouncer_ignore_admins 過濾器:若回傳 false,即使是管理員也會被踢出。
wp_bouncer_redirect_url 過濾器:可用於更改被踢出後重定向的 URL。
wp_bouncer_number_simultaneous_logins 過濾器:可設定限制登入次數的數量不為 1。0 表示不限制登入次數。
wp_bouncer_login_flag:在彈出之前運行(可用於潛在停止彈出)。
wp_bouncer_session_ids 鉤子:用於在保存時過濾會話 ID。將 $session_ids、$old_session_ids(在任何會話被刪除/彈出之前)和當前使用者的 ID 傳遞為參數。
wp_bouncer_session_length 鉤子:用於過濾會話 ID 產生的暫存資料的有效期限。這樣可以讓您時間掌控紀錄在午夜時過期的暫存。請注意,臨時資訊在每次網頁載入時進行保存,如果您設置為 5 分鐘,則每次網頁載入都會將其推遲 5 分鐘。建議設置為(距離午夜的秒數)或類似的時間長度。

支持外掛作者:

如果您喜歡這個外掛程式,請查看 Jason 與 Stranger Studios 和 Paid Memberships Pro 的作品。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP Bouncer – Limit Simultaneous Logins」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

WP Bouncer restricts the number of simultaneous logins for the same WordPress user account. The plugin’s goal is to deter people from sharing their login credentials for your site, which is especially important for a paid membership, premium content, or eLearning site.
How WP Bouncer Protects Shared User Logins

The plugin stores a random FAKESESSID for each user when they log in.
If a user is logged in, on each page load (init hook), WP Bouncer checks if the FAKESESSID stored in the user’s cookies is the same as the last login stored in a transient (fakesessid_user_login).
If the two values do no match, WP Bouncer logs the user out and redirects them to the WordPress login page or a custom page using the wp_bouncer_redirect_url filter.

If the WP_BOUNCER_HEARTBEAT_CHECK is defined to true, JavaScript will be loaded to bounce users when a new user logs in with the same login. This is useful for sites with page caching.
Admininstrator accounts or any users with the “manage_options” capability are excluded from bounces.
Or, Allow a Specific Number of Active Sessions
By default, WP Bouncer only allows one session per user.
You can use this plugin to offer bulk memberships to corporate, education, or other group-type customers via a shared login.
Use the wp_bouncer_number_simultaneous_logins filter to allow a defined number of active “sessions”.
View the Recipe
Example Use Cases for WP Bouncer

User A logs in as “user”. Their FAKESESSID, say “SESSION_A” is stored in a WordPress option.
User B logs in as “user”. Their FAKESESSID, say “SESSION_B” is overwrites the stored WordPress option.
User A tries to load a page on your site, WP Bouncer catches them and logs them out, redirecting them to the warning message.
User B can browse around the site as normal… unless…
User A logs in again as “user”. Their FAKESESSID, “SESSION_A_v2” is stored in the WordPress option.
Now user B would be logged out if they load another page.

Hooks and Filters

wp_bouncer_ignore_admins filter: if returning false even admins will be bounced.
wp_bouncer_redirect_url filter: can be used to change the URL redirected to after being bounced.
wp_bouncer_number_simultaneous_logins filter: can be set to limit logins to a number other than 1. 0 means unlimited logins.
wp_bouncer_login_flag: runs right before bouncing (can be used to potentially stop the bouncing).
wp_bouncer_session_ids hook: used to filter session ids when saving them. Passes $session_ids, $old_session_ids (before any were removed/bounced), and the current user’s ID as parameters.
wp_bouncer_session_length hook: used to filter how long the session ids transients are set. This way, you can time the transients to expire at a specific time of day. Note that the transient is saved on every page load, so if you set it to 5 minutes, it’s going to push it out 5 minutes on every page load. You should try to set it to (the number of seconds until midnight) or something like that.

Support the Plugin Authors
If you like this plugin, please check out Jason’s work with Stranger Studios and Paid Memberships Pro and Andrew’s work at his personal site.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon