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

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

前言介紹

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

外掛協作開發者

liveaspankaj |

外掛標籤

lms | hide | lifter | elearning | hide content |

內容簡介

Visibility Control for LifterLMS 是一款WordPress外掛,可以根據特定標準在WordPress頁面上任何位置隱藏信息和內容。你可以基於以下標準顯示/隱藏HTML元素、菜單和其他詳細信息:

1. 使用者對特定Lifter LMS課程的訪問權限。
2. 使用者對特定Lifter LMS課程的課程完成狀態。
3. 使用者是否登入或登出。
4. 使用者的角色。

你只需要向你的元素div或span添加CSS類,就可以實現這些功能。例如:

登入/登出狀態:
- 若要向已登入的使用者顯示元素/菜單項目,請添加此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。
- 注意:要僅向多個特定角色顯示元素,您需要將元素多次添加,每個角色添加一次。要僅從多個特定角色中隱藏元素/菜單,您可以在同一元素中添加多個類。

如果課程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。

對於課程完成狀態,如果課程ID為123:
- 若要向完成該課程的使用者顯示元素/菜單項目,請添加此CSS類:visible_to_course_complete_123。
- 要從完成該課程的使用者隱藏元素/菜單項目,請添加此CSS類:hidden_to_course_complete_123。
- 若要向未完成該課程的使用者顯示元素/菜單項目,請添加此CSS類:visible_to_course_incomplete_123。
- 要從未完成該課程的使用者隱藏元素/菜單項目,請添加此CSS類:hidden_to_course_incomplete_123。

功能機制:
- 如果添加了多個可見性控制類,則所有這些類都必須滿足標準才能保持元素可見。如果其中任何一個隱藏了元素,則它將隱藏。
- 隱藏的數據/元素將到達瀏覽器。雖然使用者看不見它。
- 根據上述規則,為所有需要隱藏的CSS元素添加CSS到頁面上。
- 載入頁面後,使用jQuery(如果可用)從頁面中刪除這些元素,因此它們將無法在檢查中使用。
- 在頁面載入後渲染的元素將被隱藏,但不會從DOM /頁面中移除。

未來發展:
根據對此功能的興趣,我們將決定添加簡碼和/或Gutenberg區塊來實現此功能。

相關的外掛:
- Visibility Control for LearnDash:針對LearnDash LMS用戶的類似外掛程式。允許基於課程訪問權限和組訪問進行控制。
- Visibility Control for WooCommerce:允許基於使用者購買的特定WooCommerce產品或變化進行控制。

問題:
1. 使用什麼樣的標準可以顯示/隱藏HTML元素和菜單?
2. 舉例說明如何使用外掛,將元素/菜單項目顯示給已登入的使用者?
3. 如何設置CSS類以向特定角色顯示元素/菜單項目?
4. 如何控制特定課程的元素/菜單項目是否可見?
5. 如果已添加多個CSS類,會怎樣影響元素的可見性?

原文外掛簡介

Visibility Control for LifterLMS 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 Lifter LMS Course,
2. User’s course completion status of a particular Lifter LMS Course, Or
3. User is Logged In or Logged Out.
4. 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 WPCourseware LMS
– Visibility Control for LearnPress LMS
– Visibility Control for TutorLMS
– Visibility Control for MasterStudy LMS
– Visibility Control for Sensei LMS
– Visibility Control for WooCommerce
Related Plugins for LifterLMS:
– Experience API for LifterLMS
– Manual Completions for LifterLMS

各版本下載點

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

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


1.1 | trunk |

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

文章
Filter
Apply Filters
Mastodon