shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Providing access to third party plugin menus or other CPT for instructors

The instructor dashboard provides all the necessary tools to help an instructor to create courses, publish products, view reports, etc. and restricts access to all other menus and settings from the instructor.

Recently we have seen site admins wishing to provide access to some additional Custom Post Type (CPT) or third party plugin menus to their instructors.

There could be many examples for such scenarios but few instances for such scenarios would be, website admins who use interactive learning content or some custom webinar or meetings software to teach their students and would want their instructors to also make use of them to create the interactive learning content or host such meetings and webinars.

The following steps would illustrate how to provide access to Custom Post Types (CPT) for the instructors.

Step 1: Enable access to the CPT

The instructor dashboard enables access to selective posts including the default CPT added by LearnDash such as courses, topics, lessons, quizzes and questions.

Similarly to enable access to your CPT you need to know the slug of your CPT.

In the following example we will demonstrate allowing access to the zoom meetings CPT added by the zoom video conferencing addon.

/**
 * Enable instructors access to Zoom Meetings
 * 
 * @author  Kumar Rajpurohit
 */
function irAllowZoomAccess( $post_types_allowed ) {
	// Add the CPT slug to the list of allowed post types for instructors.
	$post_types_allowed[] = 'zoom-meetings';

	return $post_types_allowed;	
}
add_filter('wdmir_set_post_types', 'irAllowZoomAccess');

Step 2: Allow access to the CPT menu screens on Instructor Dashboard

Next we move ahead to allowing access to the menu screens added by the CPT on the Instructor Dashboard.

To do so, we need to know the screen ids for all the menu screen added by the CPT and the ones you wish that you display on the Instructor Dashboard.

/**
 * Enable Zoom Tab Access
 * 
 * @author  Kumar Rajpurohit
 */
function irZoomTabAccess($tabs) {
	// Enable access to zoom screen menus
    $tabs[] = 'edit.php?post_type=zoom-meetings';

    return $tabs;
}
add_filter('wdmir_add_dash_tabs', 'irZoomTabAccess');

Step 3: Add exceptions to allow access to CPT screens and posts

This is the last step in providing access to CPT for instructor dashboard.

This step is more related to uplifting security access for the CPT screens and posts in general, which if normally tried to access will return a restricted permission message.

/**
 * Allow access to Zoom screens 
 * 
 * @author  Kumar Rajpurohit
 */
function irAllowZoomPagesAccess($restict_access, $page_data) {
    global $current_screen;
    if (! wdm_is_instructor()) {
        return $restict_access;
    }

	// Add the CPT slug and screen ID to allow access
    if ('zoom-meetings' == $page_data['get_post_type'] || 'zoom-meetings' == $current_screen->post_type) {
        $restict_access = false;
    }
    return $restict_access;
}
add_filter('ir_filter_deny_page_access', 'irAllowZoomPagesAccess', 10, 2);

That’s it, this would help allow access to the CPT and its screens on the Instructor Dashboard.

It is very much possible that even after following all of the above steps your CPT might not work exactly as expected for your instructors due to some dependencies or conflicts and it is because of this we do not guarantee compatibility with 3rd party plugins.

In case you need help with such cases or anything else, feel free to reach out to us and we will try to support you in the best way possible.

Updated on September 21, 2021
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Was this article helpful?

shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php
shvsh > /home/1168859.cloudwaysapps.com/rcyqmhwrmv/public_html/docs/wp-content/plugins/ht-knowledge-base/ht-knowledge-base.php

Related Articles