
內容簡介
這個外掛會新增一個區塊到你的區塊編輯器。
這個區塊會根據目前使用者的權限改變顯示內容。
你可以設定區塊需要的權限。
如果目前使用者有區塊所需的權限,內容就會被取代。
反之,區塊會顯示為登入鏈結。
這個區塊是內部區塊,所以你可以在裡面巢狀擺放其他區塊。將其轉換為可重複使用的區塊有助於增加產能。
請參閱截圖,以查看區塊的顯示外觀。
這個外掛使用 REST API 來轉換區塊內容,所以即使你使用快取的 WordPress,也可以使用它。
即使你使用類似CloudFront或Cloudflare的 CDN,這個外掛也會針對每個使用者顯示正確的內容。
為了提高效能,建議使用Cookie Tasting。
這個外掛可以透過檢查 COOKIE 值,減少伺服器存取,包括 REST API 存取伺服器端腳本。
外掛標籤
開發者團隊
原文外掛簡介
This plugin adds a block to your block editor.
This block changes its display depending on a current user’s capability.
You can set capability for block.
If a current user has a capability for the block, its content will be replaced.
Or else, block is displayed as log in link.
This block is an inner block, so you can nest any blocks inside it. Convert it to a reusable block for your productivity.
See screenshot for how block will be displayed.
This plugin use REST API to convert block content, so you can use it with cached WordPress.
Even if you use CDN like CloudFront or Cloudflare, this plugin displays proper contents for each users.
For performance enhancement, Cookie Tasting is recommended.
It decreases server access including REST API by checking COOKIE value before accessing to server side script.
Hooks
Display Customization
fyeo_tag_line – Customize the default tagline displayed to users without capability. %s will be replaced with login URL.
fyeo_login_url – Replace the login URL. Default is wp_login_url().
fyeo_redirect_url – Customize redirect URL after login. Receives post object as second argument.
fyeo_redirect_key – Change query parameter key for redirect. Default is redirect_to.
fyeo_enqueue_style – Whether to enqueue default theme style. Return false to disable.
Capability Control
fyeo_capabilities_list – Customize available capabilities list shown in block settings.
fyeo_default_capability – Change default capability. Default is read.
fyeo_user_has_cap – Override capability check result. Receives $has_cap, $capability, $user.
Rendering
fyeo_default_render_style – Set default rendering style. Return dynamic for PHP rendering, empty string for async.
fyeo_can_display_non_public – Allow displaying restricted content for non-public posts. Receives $post object.
REST API
fyeo_minimum_rest_capability – Control REST API access. Return false to deny access.
