Title: Visibility Control for LearnDash
Author: Pankaj Agrawal
Published: <strong>2019 年 8 月 28 日</strong>
Last modified: 2025 年 9 月 11 日

---

搜索插件

![](https://ps.w.org/visibility-control-for-learndash/assets/banner-772x250.png?
rev=2146785)

![](https://ps.w.org/visibility-control-for-learndash/assets/icon-256x256.png?rev
=2146785)

# Visibility Control for LearnDash

 作者：[Pankaj Agrawal](https://profiles.wordpress.org/liveaspankaj/)

[下载](https://downloads.wordpress.org/plugin/visibility-control-for-learndash.zip)

 * [详情](https://cn.wordpress.org/plugins/visibility-control-for-learndash/#description)
 * [评价](https://cn.wordpress.org/plugins/visibility-control-for-learndash/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/visibility-control-for-learndash/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/visibility-control-for-learndash/#developers)

 [支持](https://wordpress.org/support/plugin/visibility-control-for-learndash/)

## 描述

Visibility Control for [LearnDash](https://www.nextsoftwaresolutions.com/r/learndash/wp_vcl_plugin_page)
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, any or all **LearnDash Course**, Or 2. User’s access to a particular,
any or all **LearnDash Group**, 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.

For all the courses:

 * To show the element/menu item to user with access to all the Courses, add this
   CSS class: **visible_to_course_all**
 * To hide the element/menu item from user with access to all the Courses, add this
   CSS class: **hidden_to_course_all**
 * To show the element/menu item to users not enrolled in any Course, add this CSS
   class: **visible_to_course_none**
 * To hide the element/menu item from users not enrolled in any Course, add this
   CSS class: **hidden_to_course_none**

For a specific course, 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**

For users with access to at least one course:
 * Add this CSS class: **hidden_to_course_none**

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**

For all the groups:

 * To show the element/menu item to user with access to all the groups, add this
   CSS class: **visible_to_group_all**
 * To hide the element/menu item from user with access to all the groups, add this
   CSS class: **hidden_to_group_all**
 * To show the element/menu item to users not enrolled in any group, add this CSS
   class: **visible_to_group_none**
 * To hide the element/menu item from users not enrolled in any group, add this 
   CSS class: **hidden_to_group_none**

For a specific group, if Group ID is 123:

 * To show the element/menu item to user with access to above Group, add this CSS
   class: **visible_to_group_123**
 * To hide the element/menu item from user with access to above Group, add this 
   CSS class: **hidden_to_group_123**

For users with access to at least one group:
 * Add this CSS class: **hidden_to_group_none**

**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_group_123 visible_to_group_124
   will show the element only to those who have access to both groups.
 * 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 even 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](https://www.nextsoftwaresolutions.com/learndash-visibility-control/)–
[Visibility Control for WP Courseware LMS](https://www.nextsoftwaresolutions.com/visibility-control-for-wp-courseware/)–
[Visibility Control for LearnPress LMS](https://www.nextsoftwaresolutions.com/visibility-control-for-learnpress/)–
[Visibility Control for LifterLMS](https://www.nextsoftwaresolutions.com/visibility-controlfor-lifterlms/)–
[Visibility Control for TutorLMS](https://www.nextsoftwaresolutions.com/visibility-control-for-tutorlms/)–
[Visibility Control for MasterStudyLMS](https://www.nextsoftwaresolutions.com/visibility-control-for-masterstudy/)–
[Visibility Control for Sensei LMS](https://www.nextsoftwaresolutions.com/visibility-control-for-sensei/)–
[Visibility Control for WooCommerce](https://www.nextsoftwaresolutions.com/woocommerce-visibility-control/)

**Related Plugins for LearnDash LMS:**
 * [Manual Completions for LearnDash LMS](https://www.nextsoftwaresolutions.com/manual-completions-for-learndash/)*
[Manage Enrollment for LearnDash LMS](https://www.nextsoftwaresolutions.com/manage-enrollment-for-learndash/)*
[Autocomplete LearnDash Lessons and Topics](https://www.nextsoftwaresolutions.com/autocomplete-learndash-lessons-and-topics/)

It is pretty similar to this plugin and having same features, it allows controlling
the visibility of HTML elements based user’s purchase of a particular WooCommerce
Product or Variation.

## 屏幕截图

[⌊Show menu only to Logged In user (or Course/Group access)⌉⌊Show menu only to Logged
In user (or Course/Group access)⌉[

Show menu only to Logged In user (or Course/Group access)

[⌊Show menu only to Loggout user⌉⌊Show menu only to Loggout user⌉[

Show menu only to Loggout user

[⌊Show a message if user has access to course (using HTML anywhere)⌉⌊Show a message
if user has access to course (using HTML anywhere)⌉[

Show a message if user has access to course (using HTML anywhere)

[⌊Show a message if user doesn't have access to course (using Additional CSS class)⌉⌊
Show a message if user doesn't have access to course (using Additional CSS class
)⌉[

Show a message if user doesn’t have access to course (using Additional CSS class)

## 安装

This section describes how to install the plugin and get it working.

e.g.

 1. Upload the plugin files to the `/wp-content/plugins/visibility-control-for-learndash`
    directory, or install the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Add the CSS classes to your HTML elements or Menu Items as described in the Details
    section.

## 常见问题

### What is LearnDash LMS?

[LearnDash LMS](https://www.nextsoftwaresolutions.com/r/learndash/wp_vcl_plugin_page)
is the number one WordPress based Learning Management System (LMS) plugin. It includes
many advanced features including, quizzing engine, course management, reports, certificates
and payment methods.

You can also add [GrassBlade xAPI Companion plugin](https://www.nextsoftwaresolutions.com/grassblade-xapi-companion/)
and [GrassBlade LRS](https://www.nextsoftwaresolutions.com/grassblade-lrs-experience-api/)
to start using Experience API (xAPI) based contents with [LearnDash LMS](https://www.nextsoftwaresolutions.com/r/learndash/wp_vcl_plugin_page).

### What is GrassBlade xAPI Companion plugin?

[GrassBlade xAPI Companion](https://www.nextsoftwaresolutions.com/grassblade-xapi-companion/)
is a paid WordPress plugin that enables support for Experience API (xAPI) based 
content on WordPress.

It also provides best in industry Advanced Video Tracking feature, that works with
YouTube, Vimeo and self-hosted MP4 videos. Tracking of MP3 audios is also supported.

It can be used independently without any LMS. However, to add advanced features,
it also has integrations with several LMSes.

### What is GrassBlade Cloud LRS?

[GrassBlade Cloud LRS](https://www.nextsoftwaresolutions.com/grassblade-lrs-experience-api/)
is a cloud-based Learning Record Store (LRS). An LRS is a required component in 
any xAPI-based ecosystem. It works as a data store of all eLearning data, as well
as a reporting and analysis platform. There is an installable version which can 
be installed on any PHP/MySQL based server.

## 评价

![](https://secure.gravatar.com/avatar/e6e1d2648243bb526e9626abe0982d80dfeeac91783508eff191e4412ac8b36d?
s=60&d=retro&r=g)

### 󠀁[Great plugin](https://wordpress.org/support/topic/great-plugin-37697/)󠁿

 [golaxo](https://profiles.wordpress.org/golaxo/) 2023 年 10 月 3 日

Does exactly what promises

![](https://secure.gravatar.com/avatar/34fbfc877e485bb89ac91a62f422d973fdbdddffce3a245472a7857b565f6910?
s=60&d=retro&r=g)

### 󠀁[Excellent, exactly what I was looking for](https://wordpress.org/support/topic/excellent-exactly-what-i-was-looking-for-3/)󠁿

 [lorilself](https://profiles.wordpress.org/lorilself/) 2023 年 7 月 9 日

This does the job – we needed a way to display a specific LearnDash course only 
after the prereq course is completed. This plugin makes it very easy to accomplish
this – thank you!

![](https://secure.gravatar.com/avatar/5cea4bfa8a541ad37085e0b0cf93397b728b02d9616b100255b20a7fa10f0740?
s=60&d=retro&r=g)

### 󠀁[Good Plugin!](https://wordpress.org/support/topic/good-plugin-6417/)󠁿

 [moshesitin](https://profiles.wordpress.org/moshesitin/) 2023 年 4 月 19 日

Very Good Plugin!

![](https://secure.gravatar.com/avatar/b34bab1938a095e7bc43d709744804a0290d4060e575a638190de4ff3e480542?
s=60&d=retro&r=g)

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-9592/)󠁿

 [julien_e](https://profiles.wordpress.org/julien_e/) 2022 年 11 月 11 日

Really needed this, and it did the job perfectly. Thanks!

![](https://secure.gravatar.com/avatar/25f023562980631b015f64e99201bce41a63f80ca6c09b22644a11b016a05405?
s=60&d=retro&r=g)

### 󠀁[Good plug, great support](https://wordpress.org/support/topic/good-plug-great-support-2/)󠁿

 [havgapet](https://profiles.wordpress.org/havgapet/) 2021 年 9 月 8 日

Using it to hide / unhide videos in LMS according to enrollment status.

![](https://secure.gravatar.com/avatar/7e02844e74c370c298a5697e3b13a6917e551f729542b5f9ff34b4fe1ef32d30?
s=60&d=retro&r=g)

### 󠀁[Very easy, very helpful.](https://wordpress.org/support/topic/very-easy-very-helpful/)󠁿

 [wilayatrust](https://profiles.wordpress.org/talazem/) 2020 年 10 月 21 日 1 回复

A much more elegant solution than even LD’s own student or visitor shortcode. Many
thanks!

 [ 阅读所有10条评价 ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/)

## 贡献者及开发者

「Visibility Control for LearnDash」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Pankaj Agrawal ](https://profiles.wordpress.org/liveaspankaj/)

[帮助将「Visibility Control for LearnDash」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/visibility-control-for-learndash)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/visibility-control-for-learndash/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/visibility-control-for-learndash/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/visibility-control-for-learndash/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/visibility-control-for-learndash/)。

## 更新日志

#### 1.7

 * Feature: Added support for course completion status: Example: visible_to_course_complete_123,
   visible_to_course_incomplete_123, hidden_to_course_complete_123, hidden_to_course_incomplete_123

#### 1.6

 * Feature: Added support for roles: Example: visible_to_role_administrator
 * Fixed: issues on addons page on network website.

#### 1.5

 * Fixed: jQuery 3.0 conflict on some websites.

#### 1.4

 * Feature: Added new classes: visible_to_course_none, hidden_to_course_none, visible_to_course_all,
   hidden_to_course_all, visible_to_group_none, hidden_to_group_none, visible_to_group_all,
   hidden_to_group_all

#### 1.3

 * Improvement: Compatible with different editors now: Gutenberg, WPBakery Builder,
   Visual Composer, Elementor, Brizy Builder, Beaver Builder, Divi

#### 1.2

 * Feature: Added support for LearnDash Groups. (.visible_to_group_123, .hidden_to_group_123)
 * Feature: Hidden elements are now removed after page is loaded (using jQuery, 
   if available)
 * Improvement: Added to LearnDash menu

#### 1.1

 * Added Add-ons page

#### 1.0.3

Fixed: Not working due to wrong action

#### 1.0.2

 * Disabled checking from wp-admin area to avoid block from getting hidden from 
   the editor

#### 1.0.1

Fix: Disable the visiblity functionality when LearnDash is not installed

## 额外信息

 *  版本 **1.7**
 *  最后更新：**9 月前**
 *  活跃安装数量 **1,000+**
 *  WordPress 版本 ** 4.0 或更高版本 **
 *  已测试的最高版本为 **6.8.5**
 *  PHP 版本 ** 5.6 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/visibility-control-for-learndash/)
 * 标签
 * [elearning](https://cn.wordpress.org/plugins/tags/elearning/)[hide](https://cn.wordpress.org/plugins/tags/hide/)
   [hide content](https://cn.wordpress.org/plugins/tags/hide-content/)[learndash](https://cn.wordpress.org/plugins/tags/learndash/)
   [lms](https://cn.wordpress.org/plugins/tags/lms/)
 *  [高级视图](https://cn.wordpress.org/plugins/visibility-control-for-learndash/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  9 条 5 星评价     ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/visibility-control-for-learndash/reviews/)

## 贡献者

 *   [ Pankaj Agrawal ](https://profiles.wordpress.org/liveaspankaj/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/visibility-control-for-learndash/)