Grant LearnDash Courses Access to Enrolled Students only

While Prevent Direct Access Gold & Access Restriction extension allows you to secure LearnDash eLearning content URLs, LMS Integration will help you to grant students access to their courses only. In other words, LearnDash students are able to see the eLearning content of the courses in which they have enrolled. If they attempt to access the materials of other courses, they will see a 404 no access page by default.

To do so, please follow the steps below:

  1. Disable Tin Canny built-in module protection 
  2. Protect uncanny-snc folder
  3. Set up advanced permission 

Requirements:

Disable Tin Canny built-in protection module

Tin Canny LearnDash Reporting comes with built-in module protection which allows LearnDash users to protect their SCORM/Tin Can Modules. However, it just provides basic protection that restricts viewing of the content to logged-in users only. If you want to restrict access to your course materials at an advanced level with our plugins, you need to disable this option first.

To achieve it, navigate to Tin Canny Reporting >> Settings from your admin dashboard.

Choose No under “Protect SCORM/Tin Can Modules?” option.

If you’ve enabled this option before and using Apache server, then go to your wp-content >> uploads >> uncanny-snc folder and rename the .htaccess file.

You do not have to follow this step if you’re using Nginx servers, e.g. Kinsta and WP Engine hosting.

Protect uncanny-snc folder

All media files uploaded via Tin Canny Uploader will be stored in uncanny-snc folder under your WordPress uploads directory. Since they won’t display under your Media Library, you need to use PDA Access Restriction extension to protect the entire folder from unauthorized users.

  1. Select uncanny-snc folder to protect.
  2. Grant logged-in users to access all protected files under this folder.

Advanced Permission Checking

Our LMS Integration works seamlessly with LearnDash and Tin Canny LearnDash Reporting without any extra configuration.

However, if you want complete protection to your course files, you may want to define and associate each folder to specific courses as follow.

Simply copy this code, put them on your wp-config.php file and change the folder and course ID accordingly.

define( 'PDA_FOLDER_PROTECTION',
   [
      [
         'folder' => 'uncanny-snc/1',
         'courses' => [2098, 2897], // the course ID - post ID of the course(s) where you files are embedded on 
      ],
      [
         'folder' => 'uncanny-snc/2',
         'courses' => [2102],
      ],
      [
         'folder' => 'uncanny-snc/3',
         'courses' => [2106],
      ],
   ]
);
Lasted updated on September 8, 2021