[WordPress] 外掛分享: Secure Role-Restricted Draft Previews

WordPress 外掛 Secure Role-Restricted Draft Previews 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Secure Role-Restricted Draft Previews」是 2025-09-15 上架。
  • 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
  • 上一次更新是 2025-10-02,距離現在已有 147 天。
  • 外掛最低要求 WordPress 6.4 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 8.1 以上。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

pixypuala |

外掛標籤

roles | drafts | preview | security | access-control |

內容簡介

總結:這個 WordPress 外掛提供了一個在草稿預覽方面缺失的中間地帶,可以透過身分驗證和訪問控制列表來安全保護預覽,並提供分析和一鍵撤銷功能。

**問題與答案:**

1. 這個外掛提供了什麼缺失的中間地帶?
- 可以安全保護預覽,並具有身分驗證和訪問控制列表。

2. 這個外掛是如何保證隱私的?
- IP 地址是使用 hash_hmac(sha256, ip, wp_salt('auth')) 進行雜湊處理。

3. 這個外掛是否支援多種 WordPress 主題和元件?
- 是的,它與全站編輯主題、區塊主題、傳統基於 PHP 的主題、所有頁面構建器(包括 Elementor、WPBakery、Divi 等)、WooCommerce 產品草稿以及任何 CSS 框架(包括 Tailwind CSS v4+)無縫配合。

4. 這個外掛的預覽鏈接會自動過期嗎?
- 是的,它可以創建具有到期時間(預設為 72 小時,可配置)的預覽鏈接。

5. 如何撤銷所有與某篇文章相關的預覽鏈接?
- 可以使用「Revoke All」功能進行一鍵撤銷。

6. 這個外掛是否提供開發者友好的功能?
- 是的,它提供完整的文檔化過濾器和操作,乾淨的面向對象的代碼庫,PSR-4 自動加載以及豐富的內聯文檔。

原文外掛簡介

Why this plugin?
WordPress core preview links work well for editors, and Public Post Preview shares via anonymous nonces.
This plugin adds a missing middle ground: draft previews that are secured by authentication and access control
lists (ACLs) — role-based, user-specific, or per-email tokens — plus analytics and a one-click revoke-all.
Universal Compatibility
Works seamlessly with:
* Full Site Editing (FSE) themes
* Block themes (modern WordPress)
* Classic PHP-based themes
* All page builders including Elementor, WPBakery, Divi, etc.
* WooCommerce product drafts
* Any CSS framework including Tailwind CSS v4+
Key features

Create expiring preview links (default 72h; configurable).
Restrict by roles, specific users, or per-email tokens (no login for recipients).
Require HTTPS for previews (on by default).
Per-link analytics: allowed/denied events, hashed IP, user agent (privacy-friendly).
Meta box in the editor (Post/Page by default; filterable) to generate, copy, and revoke.
“Revoke All” for a post.
Everything prefixed (srpl_), sanitized, and aligned with WordPress coding standards.

How it works
Each generated link has a unique token, TTL, and ACL:

Role-based Access: Requires login. Only users with allowed roles can view the preview.
User-based Access: Requires login. Only specific user IDs can access the preview.
Email Token Access: No login required. Recipients receive unique URLs with email verification tokens.

When a link is visited, SRPL validates the token, expiry, and ACL, then renders the draft with your theme’s header/footer. Events are logged (when enabled) to a small custom table (wp_srpl_events) with hashed IP for privacy.
Privacy

IPs are hashed using hash_hmac(sha256, ip, wp_salt('auth')).
You can disable analytics entirely under Settings → Secure Previews.

Developer Friendly

Fully documented filters and actions
Clean, object-oriented codebase
PSR-4 autoloading
Extensive inline documentation

Developer Documentation
Filters

srpl_supported_post_types – Modify post types that support preview links
srpl_default_ttl_hours – Change default expiration time (in hours)
srpl_force_ssl – Control whether previews are forced to use HTTPS
srpl_analytics_enabled – Enable or disable analytics collection

Functions

LinkManager::create($post_id, $args) – Create a new preview link
LinkManager::revoke($link_id) – Revoke a specific link
LinkManager::revoke_all_for_post($post_id) – Revoke all links for a post
LinkManager::find_by_token($token) – Find a link by its token

Database Structure

Post Meta for Links: _srpl_token, _srpl_mode, _srpl_roles, _srpl_users, _srpl_emails, _srpl_expires, _srpl_revoked, _srpl_hits, _srpl_last_access
Analytics Table: wp_srpl_events (link_id, post_id, user_id, outcome, ip_hash, ua, created_at)

License
This plugin is free software, licensed under the GPL v2 or later.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Secure Role-Restricted Draft Previews」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.0.1 | trunk |

延伸相關外掛(你可能也想知道)

  • Members – Membership & User Role Editor Plugin 》Members 是一個基於 WordPress 會員的權限和能力外掛。它提供強大的工具,讓您可以新增角色和能力,並將它們分配給使用者,調整使用者權限來提供最佳的會員體...。
  • If Menu – Visibility control for Menus 》藉由可見度規則,您可以控制網站訪客看到哪些選單項目。以下是一些範例:, , 僅顯示選單項目,當 使用者已登入, 當裝置為行動裝置時,隱藏選單, 顯示選單 給...。
  • View Admin As 》最終的使用者切換器和角色管理員, 此外掛程式將在管理列中新增一個選單項目,您可以透過它在 WordPress 後台中切換視角。, 無需登入其他使用者帳號,您便可以...。
  • Expire Users 》, 重要的安全更新–如果您正在使用版本0.2或更早的版本,請進行升級, , 此外掛允許您為用戶登錄設置到期日期。 您可以設置用戶為:, , 永不到期(默認值), 在...。
  • Restrict Media Library Access 》這個外掛可以限制作者和貢獻者的存取權限,讓他們只能看到自己上傳到媒體庫中的檔案。, 這個外掛有兩個主要用途:當媒體庫過於龐大時,讓作者更容易找到自己...。
  • HM Multiple Roles 》這個HM Multiple Roles外掛提供使用者介面,允許你為使用者選擇多個角色。, 它隱藏了預設的角色下拉式選單,並在新使用者及更新使用者頁面上顯示角色勾選框清...。
  • Privilege Menu 》這個外掛讓你能夠根據用戶的登入狀態、登出狀態或使用者所分配的角色來顯示選單項目。, 此外掛可允許在每個單一選單項目上新增細緻權限,以根據使用者的登入...。
  • If Widget – Visibility control for Widgets 》透過If Widget 插件,您可以控制 widget 顯示的頁面。使用自訂可見性規則(無需 PHP 或技術知識),顯示或隱藏 widget。, 此插件易於使用,每個 widget 都會...。
  • Woocommerce Role Pricing 》根據使用者角色設定自訂價格。, 因為並非所有的客戶都相同,請將他們按角色分組,自動為他們套用折扣。, 分銷商、商務人員、高級客戶,可以建立任意多個角色...。
  • WP Roles at Registration 》這款外掛讓使用者可以在註冊時從已選擇角色列表中選擇自己在網站中的角色。它也適用於 BuddyPress。它提供了一個界面,供管理員選擇在使用者註冊時顯示哪些角...。
  • Total User Count Shortcode 》總用戶數外掛會增加一個短代碼,以顯示您的 WordPress 網站中的用戶帳戶數。沒有管理畫面,只有短代碼 [total_user_count], 新增:取得特定角色的用戶數量, ...。
  • Members – Role Hiearchy 》Members – Role Hierarchy 是為 Members 外掛 開發的附加外掛,可添加階層式角色系統。, 當您希望允許較低級別的使用者(如編輯者)創建、編輯、晉升或...。
  • Menu Visibility Control 》總結:Menu Visibility Control 外掛讓你輕鬆選擇誰可以看到每個選單項目,包括所有人、只有登入使用者、只有登出使用者、特定使用者角色。該外掛選項直接出...。
  • Map Cap 》在您的網站上使用自訂文章類型嗎?, 安裝此外掛程式以控制哪些角色可以發佈、編輯和刪除每個自訂類型的文章。, 為了讓這個外掛程式發揮作用,您的自訂文章類...。
  • Custom Access Roles 》2.0.0版新增功能:使用自訂角色的使用者現在只會看到分配給他們的文章或頁面。我們還精簡了管理介面,讓配置更輕鬆,同時新增了額外的說明,以協助您將正確的...。

文章
Filter
Mastodon