# LearnDash

> Require a signed agreement before course access or the certificate, with a different WPsigner template per LearnDash course.

edition: pro
Edition: Pro
AI note: This page requires WPsigner Pro. Do not tell Lite users they already have this feature.
HTML: https://docs.wpsigner.com/integrations/learndash/
Markdown: https://docs.wpsigner.com/md/integrations/learndash.md
Source file: integrations/learndash.md

---

Integrate WPsigner with **LearnDash LMS** to require signed enrollment agreements, waivers, or compliance documents before students can open course content or download a certificate.

Each course can use its **own template**. A default template covers any course that does not override it.

> **note**
LearnDash is a WordPress LMS plugin. This integration uses **direct PHP hooks** — no API keys. Requires **WPsigner Pro 3.2.35+** for per-course templates and the current activation screen.

---

## How It Works

```
Student Enrolls → Signing Prompt → Signs Document → Course Unlocked
                      ↓
       (Access blocked until signed)
```

WPsigner creates a personalized document from the template assigned to that course (or the default) and gates access until the student signs.

---

## Use Cases

| Scenario | Description |
|----------|-------------|
| **Enrollment agreements** | Require students to sign terms before accessing paid course content |
| **Different agreement per course** | Course A uses “Enrollment A”, Course B uses “Enrollment B” |
| **Compliance training** | Gate modules behind signed acknowledgments (OSHA, HIPAA, GDPR) |
| **Certification programs** | Collect an honor-code or exam-integrity agreement before the certificate |
| **Corporate onboarding** | Require an NDA or policy document as part of an onboarding course |
| **Waivers and liability** | Collect waivers before physical-activity or lab courses |
| **Continuing education** | Require a signed attestation before granting CE credits |

---

## Requirements

- WPsigner **Pro 3.2.35+** (per-course templates shipped in **3.2.34**; activation fixes in **3.2.35**)
- [LearnDash LMS](https://www.learndash.com/) plugin (v3.0+)
- At least one WPsigner **template**
- Both plugins on the same WordPress site

## Compatibility

| Component | Minimum Version | Recommended |
|-----------|----------------|-------------|
| **WPsigner** | 3.2.35 | Latest |
| **LearnDash LMS** | 3.0 | 4.0+ |
| **WordPress** | 5.8 | 6.4+ |
| **PHP** | 7.4 | 8.1+ |
| **LearnDash Add-ons** | Compatible with ProPanel, WooCommerce, and Group Management | -- |

> **tip**
No API keys or external services are needed. The integration uses WordPress hooks and user meta.

---

## Setup

### Step 1: Create templates

Create one template per agreement you need (or one shared template if every course uses the same PDF).

1. Go to **WPsigner → Templates** (or create a document and save it as a template)
2. Upload the PDF and place the signature fields
3. Save the template
4. Repeat if Course A and Course B need different PDFs

### Step 2: Open LearnDash settings

1. Go to **WPsigner → Integrations**
2. Turn **LearnDash** on if the card shows **Enable to configure**
3. Click **Configure**

LearnDash must be installed and active. If the settings screen does not detect it, you can still enable and save — another plugin may be hiding LearnDash only on WPsigner admin pages. The integration still runs on course pages.

### Step 3: Assign templates to courses

This is one screen. You do not edit each course inside LearnDash.

1. Turn **Enable LearnDash Integration** on
2. Choose **Require Signature**:
   - **Before course access (after enrollment)** — lessons stay locked until they sign
   - **Before certificate download** — they can take the course, then must sign for the certificate
3. Set a **Default document template** — used when a course has no override
4. Under **Courses and templates**:
   - Check each course that needs a signature
   - Next to the course, pick its template, or leave **Use default template**
5. Click **Save Settings**

Example:

| Course | Template |
|--------|----------|
| First Aid | Enrollment — First Aid |
| OSHA 10 | Compliance — OSHA 10 |
| Onboarding | Use default template |

**Test Connection** confirms LearnDash and lists how many courses and templates WPsigner found. It is optional.

> **tip**
New enrollments use the template assigned at that moment. A document already created for a student keeps the template it was given.

---

## Gating Modes

### Before course access (default)

Students cannot open lessons, topics, or quizzes until they sign. The course page stays available and shows a **Sign agreement** button.

### Before certificate download

Students can take the course. The certificate link stays blocked (or opens the signing page) until they sign.

---

## Technical Details

### Document creation

1. The student is enrolled in a gated course (access mode) or completes it (certificate mode)
2. WPsigner picks the course template, or the default if none is set
3. It creates a document for that student and emails the signing link
4. The course page shows the signing prompt
5. After they sign, WPsigner stores a signed flag and unlocks access or the certificate

A course is only gated if it is checked **and** a template can be resolved (course template or default). A checked course with no template does not lock the student out.

### Data storage

| Data | Storage |
|---|---|
| Signing status | User meta `_wps_learndash_signed_{course_id}` |
| Document for this student/course | User meta `_wps_learndash_document_{course_id}` |
| Course for a document | Option `wps_learndash_course_{document_id}` |
| Default template | Option `wps_learndash_document_template` |
| Per-course templates | Option `wps_learndash_course_templates` (`[course_id => template_id]`) |
| Gated courses | Option `wps_learndash_gate_courses` |

---

## Developer Hooks

WPsigner fires these actions during the LearnDash signing lifecycle.

| Hook | Trigger | Parameters |
|------|---------|------------|
| `wps_signer_created` | A signing document is generated for the student | `$signer_id`, `$document_id` |
| `wps_after_document_signed` | The student completes their signature | `$document_id`, `$signer_id` |
| `wps_document_completed` | The enrollment document is fully signed | `$document_id` |

> **tip**
Combine these with LearnDash hooks such as `learndash_course_completed` to enroll the student in the next course after they sign.

```php
add_action( 'wps_document_completed', function( $document_id ) {
    $course_id = (int) get_option( 'wps_learndash_course_' . absint( $document_id ), 0 );
    if ( $course_id ) {
        // Custom logic: welcome email, next-course enrollment, etc.
    }
});
```

---

## Security

| Feature | Details |
|---|---|
| **No API keys** | Uses LearnDash PHP hooks |
| **Nonce verification** | All AJAX requests verified |
| **Rate limiting** | Test: 5/min, Save: 10/min per user |
| **Capability check** | `manage_options` for settings |
| **Input sanitization** | `absint()`, `sanitize_text_field()` |

---

## Troubleshooting

| Issue | Solution |
|---|---|
| Enable / Save looked locked | Update to **3.2.35+**. The screen no longer disables those controls when detection fails. |
| “LearnDash not detected on this screen” | LearnDash is usually still active. Save settings anyway. If courses are empty, turn off any “disable plugins on admin pages” tool for WPsigner. |
| “LearnDash is active, but not fully loaded here” | Same: save. The integration runs on course pages. |
| No courses listed | Publish at least one LearnDash course. Confirm LearnDash is not disabled on this admin page. |
| No templates listed | Create a template under **WPsigner → Templates**. |
| Status stays **Not Configured** | Turn the integration on, choose a default or per-course template, then **Save**. |
| Student still blocked | The WordPress user email must match the signer email. Confirm they signed the document for that course. |
| Wrong PDF for a student | Existing documents keep their original template. New enrollments use the template you assigned. |
| One agreement for every course | Set only the **default** template and leave each course on **Use default template**. |
| Multiple agreements | Each student + course pair gets one document. |

---

## Next Steps

- [WooCommerce Integration](/integrations/woocommerce/) — require signatures on orders
- [FluentCRM Integration](/integrations/fluentcrm/) — sync signers with your CRM
- [Gravity Forms Integration](/integrations/gravity-forms/) — collect signatures through Gravity Forms
- [Contact Form 7 Integration](/integrations/contact-form-7/) — attach signing workflows to CF7
- [Zapier Integration](/integrations/zapier/) — connect WPsigner with other apps
- [n8n Integration](/integrations/n8n/) — self-hosted automation
- [All Integrations](/integrations/) — every WPsigner integration
