[WordPress] 外掛分享: Visibility Control for LearnPress

WordPress 外掛 Visibility Control for LearnPress 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Visibility Control for LearnPress」是 2020-07-04 上架。
  • 目前有 800 個安裝啟用數。
  • 上一次更新是 2025-09-11,距離現在已有 168 天。
  • 外掛最低要求 WordPress 4.0 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

liveaspankaj |

外掛標籤

lms | hide | elearning | learnpress | hide content |

內容簡介

Visibility Control for LearnPress 能夠幫助您隱藏 WordPress 頁面上任何特定標准下的信息和內容。

根據以下標准,您可以顯示/隱藏 HTML 元素、菜單和其他細節:
1. 用戶對於特定 LearnPress 課程的訪問權限,或
2. 用戶是否已經登入或登出。
3. 用戶的角色。

您只需要將 CSS 類添加到要隱藏或顯示的 div 或 span 元素中。如下所解釋:

範例:

Login/Logout 狀態:

要向已登入用戶顯示元素/菜單項,請添加此 CSS 類: visible_to_logged_in 或 hidden_to_logged_out
要從已登入用戶隱藏元素/菜單項,請添加此 CSS 類: visible_to_logged_out 或 hidden_to_logged_in

對於用戶角色:
* 要向具有管理員角色的用戶顯示元素/菜單項,請添加此 CSS 類: visible_to_role_administrator 或 hidden_to_role_administrator
* 注意: 要僅顯示元素給多個特定角色,您需要為每個角色添加該元素。要從多個特定角色中隱藏單個元素/菜單項,您可以將多個 CSS 類添加到同一個元素中。

如果課程ID為123

要向上述課程訪問權限的用戶顯示元素/菜單項,請添加此 CSS 類: visible_to_course_123
要從上述課程訪問權限的用戶隱藏元素/菜單項,請添加此 CSS 類: hidden_to_course_123
要向已登入用戶顯示元素/菜單項,請添加此 CSS 類: visible_to_logged_in 或 hidden_to_logged_out
要從已登入用戶隱藏元素/菜單項,請添加此 CSS 類: visible_to_logged_out 或 hidden_to_logged_in

功能機制

多個 CSS 類: 如果添加了多個可見性控制類,則所有類都必須滿足標準才能保持元素可見。如果其中任何一個隱藏元素,元素將被隱藏。例如: visible_to_course_123 visible_to_course_124 只會顯示給那些有訪問兩個課程的人。
隱藏的數據/元素會到達瀏覽器。但用戶看不到它。
CSS 會為所有基於上述規則需要隱藏的 CSS 元素添加到頁面上。
加載頁面後,這些元素會使用 jQuery (如果可用) 從頁面中刪除,因此它在檢查中不會出現。
在頁面加載後呈現的元素會被隱藏,但不會從 DOM/頁面中刪除。

未來發展

根據此功能的興趣程度,我們將決定添加一個短代碼和/或可積木的區塊來實現此功能。

相關外掛

Visibility Control for LearnDash: 面向 LearnDash LMS 用戶的類似外掛。允許根據課程訪問和組訪問進行控制。同樣適用於 WooCommerce 用戶的類似外掛。

Visibility Control for WooCommerce: 允許根據用戶對特定 WooCommerce 產品或變體的購買進行控制

原文外掛簡介

Visibility Control for LearnPress helps you hide messages and content for specific criterion anywhere on your WordPress page.
You can show/hide HTML elements, menus, and other details based on:
1. User’s access to a particular LearnPress Course, Or
2. User is Logged In or Logged Out.
3. User’s role.
You simply need to add a CSS class to your element div or span. As explained here:
Example:
Login/Logout Status:

To show the element/menu item to a logged-in user, add this CSS class: visible_to_logged_in OR hidden_to_logged_out
To hide the element/menu item from a logged-in user, add this CSS class: visible_to_logged_out OR hidden_to_logged_in

For user’s role:
* To show the element/menu item to a user will role administrator, add this CSS class: visible_to_role_administrator OR hidden_to_role_administrator
* Note: To show an element to multiple specific roles only, you need add the element multiple times, one for each role. To hide an element/menu from specific multiple roles only you can add the element once add multiple classes to the same element.
If Course ID is 123

To show the element/menu item to user with access to above Course, add this CSS class: visible_to_course_123
To hide the element/menu item from user with access to above Course, add this CSS class: hidden_to_course_123
To show the element/menu item to a logged-in user, add this CSS class: visible_to_logged_in OR hidden_to_logged_out
To hide the element/menu item from a logged-in user, add this CSS class: visible_to_logged_out OR hidden_to_logged_in

For a course completion status, if Course ID is 123:

To show the element/menu item to user who completed above course, add this CSS class: visible_to_course_complete_123
To hide the element/menu item from user who completed above course, add this CSS class: hidden_to_course_complete_123
To show the element/menu item to user who has not completed above course, add this CSS class: visible_to_course_incomplete_123
To hide the element/menu item from user who has not completed above course, add this CSS class: hidden_to_course_incomplete_123

Mechanism of Functioning

Multiple CSS Classes: If multiple visibility control classes are added, ALL of them must meet the criterion to keep the element visible. If any one of them hides the element, it will be hidden. For example: visible_to_course_123 visible_to_course_124 will show the element only to those who have access to both courses.
Hidden data/elements reaches the browser. Though user’s do not see it.
CSS is added to the page for all CSS elements that needs to be hidden based on above rules.
After page is loaded. These elements are removed from page using jQuery (if available), so it won’t be available on Inspect.
Elements rendered after the page load are hidden but not removed from DOM/page.

Future Development
Depending on the interest in this feature, we will decide on adding a shortcode and/or a Gutenberg Block to achieve this feature.
Other Visibility Control Plugins:
– Visibility Control for LearnDash LMS
– Visibility Control for WP Courseware LMS
– Visibility Control for LifterLMS
– Visibility Control for TutorLMS
– Visibility Control for MasterStudyLMS
– Visibility Control for Sensei LMS
– Visibility Control for WooCommerce
Related Plugins for LearnPress:
– Experience API for LearnPress LMS
– Manual Completions for LearnPress LMS

各版本下載點

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

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


最新版本

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

  • WP Ghost (Hide My WP Ghost) – Security & Firewall 》Hide My WP Ghost 是一個 WordPress 安全外掛,透過強大且易於使用的功能,提供最佳的安全解決方案。它可以在不改變任何目錄或檔案的情況下,將網站的安全性...。
  • Email Encoder – Protect Email Addresses and Phone Numbers 》專門為電子郵件地址設計的全站保護外掛,可防止垃圾郵件機器人、電子郵件收割機和其他機器人攻擊。無需任何配置。, 此外,使用我們集成的[eeb_protect_conten...。
  • WP Hide & Security Enhancer 》WP-Hide 推出了最簡單的方法,完全隱藏 WordPress 核心文件、登錄頁面、佈景主題和外掛程式的路徑,使其不會顯示在前端,這是 Site Security 的一個巨大改進...。
  • If Menu – Visibility control for Menus 》藉由可見度規則,您可以控制網站訪客看到哪些選單項目。以下是一些範例:, , 僅顯示選單項目,當 使用者已登入, 當裝置為行動裝置時,隱藏選單, 顯示選單 給...。
  • Dynamic Visibility for Elementor 》Dynamic Visibility 擴充套件讓您可以隱藏小工具、欄位、容器、區段或頁面。, 當您正在建立不想向所有人展示的內容時,這尤其有用。, 這是一個 Elementor 的...。
  • Hide Posts 》這個外掛可以讓你隱藏首頁、分類頁、搜索頁、標籤頁、作者頁、RSS Feed、REST API、文章導覽和原生最近文章小工具的任何文章。, 試試看 Demo, 功能:, , 使用...。
  • Hide My Site 》選擇一個密碼以保護整個 WordPress 網站,只有知道此密碼的訪客才能存取您的 WordPress 網站。這是一個完美的工具,適合建立 WordPress 網站開發版本或者任何...。
  • Hide/Remove Metadata 》Hide/Remove Metadata是一款免費、簡單而非常實用的WordPress外掛,能夠幫助您輕鬆地隱藏或刪除網站上的作者和發布日期。該外掛非常容易使用,僅提供隱藏或移...。
  • Hide Admin Bar 》這個 WordPress 外掛可以隱藏 WordPress 3.1+ 的管理員工具列,感謝 Yoast 和 Pete Mall 的貢獻。如果你喜歡這個外掛,可以考慮請買我一杯咖啡。。
  • WP-ShowHide 》預設情況下,內容是隱藏的,使用者必須點擊「顯示內容」連結來切換內容。與 Engadget 為他們的新聞稿所做的方式相似。範例用法:[showhide type="pressreleas...。
  • WP Hide Post 》這個外掛強在幫助你完全控制文章的顯示方式。在 WordPress 網誌上,一般加入的文章會顯示在首頁中,通常是第一篇位置,也會同樣顯示在分類、標籤、存檔頁面等...。
  • Hide Shipping Method For WooCommerce 》s offering “Free Shipping” and “Local Pickup” on the cart page. With the Hide Shipping Method for WooCommerce plugin, you can hide all other shippi...。
  • Hide Featured Image 》有些情況下,我們可能想在某個單獨的文章頁面上顯示特色圖片,但另一些文章頁面則不想顯示。, 這個外掛可以讓您在單獨的文章頁面上顯示或隱藏特色圖片,同時...。
  • Hide Categories and Products for Woocommerce 》這個外掛可以讓你隱藏選定的類別上的店鋪產品,並隱藏類別本身,無論是在列表還是單獨頁面中。, 它可以與 Storefront(主題)短代碼兼容。, 使用方式, , 前往...。
  • Disable Media Pages 》這個 WordPress 外掛完全停用「附件」頁面。, 預設情況下,WordPress 會為每個附件建立一個頁面。這可能會有兩個不利因素:, 搜尋引擎優化, 附件頁面除了一張...。

文章
Filter
Mastodon