Developer Guide
================

This document provides information about an architecture and basic concepts of plugin "Dashing Memberships".
Minimal requirement version of PHP is 5.3

Plugin depends on installed LearnDash plugin.

Access restriction rules
---

In this plugin, restriction rules can be applied to a post by them self or a taxonomy item, such as a tag or a post category.

If on the applied restriction rule and at the same time assigned taxonomy item with active restriction, we faced a collision.  
It resolves with the following rules:

  * firstly we are collecting all taxonomy rules if they are applied for this post, we will check if user eligible to see this course (enrolled to the some of course enlisted in any assigned taxonomy item).
  * secondly, we are checking if the post has some rules for this content, If this rules active, and some of the course is selected, we reset all collected information from the first step, and checking only access restriction for this particular post.

In the other words, post rules have the highest precedence than taxonomy item, because the post rules are more specific.

In example:

1 

  * user enrolled in "course 1"
  * tag allowed access to "course 2"
  * post allowed access to "course 1" only and have assigned tag

User will see this post.

2

  * user enrolled in "course 1"
  * tag allowed access to "course 1"
  * post allowed access to "course 2" only and have assigned tag

User will NOT see this post.

Taxonomy has joined access rights:

  * if tag 1 allows access to "course 1"
  * tag 2 allows access to "course 2"
  * category 1 allows access to course "3"

and all of them are assigned to the post, so access to the post will have users enrolled to the any of this courses (course 1,2,3)

Shortcodes
---

In the plugin are available two shortcodes:

  - [ldmp_courses] - this shortcode shows the list of associated courses with the current post.  The shortcode has two parameters: 
  
    * post_id - unnecessary parameter, the post for we are showing the list of courses. The default value is the current post id, obtained by function   get_the_ID()
    * separator -unnecessary parameter, a separator between printed courses, default value is <br/>
    
 - [ldmp_courses_signup_URL] - shows a list of courses with the active link, Link is taken from "Custom Button URL" property form specific course. This shortcode has the same parameters as [ldmp_courses].
