=== SWR Course Progress for LearnDash ===
Contributors: swrice, kamran608
Tags: learndash, course progress, progress bar, elearning, lms
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Stable tag: 1.2.2

Display LearnDash student course progress with a simple, responsive shortcode — lessons, topics, quizzes & completion %.

== Description ==

**SWR Course Progress for LearnDash** adds a clean, modern course progress bar to any LearnDash course — showing lessons, topics, and quizzes completed, right on the frontend of your site. Just drop in one shortcode and you're done, no coding required.

This is a powerful and easy-to-use plugin that allows you to display student progress for any LearnDash course using a simple shortcode.

🎯 **Plugin Features**
- Easy-to-use shortcode: `[swrldcp_course_progress course_id=123]`
- **Gutenberg block** with a course-picker dropdown — no shortcode typing required
- **Sidebar widget** for classic widget areas
- **Elementor widget** and **Divi module** for page-builder users
- **Auto course detection**: drop it on a course/lesson/topic/quiz page with no course_id and it just works
- **"All My Courses" dashboard**: leave course_id out anywhere else to show every course the student is enrolled in
- **Group Leader / Admin reporting dashboard**: group leaders and admins can see every student's progress across their group's courses
- **Quiz score display**: average quiz grade, not just a completed/incomplete count
- **Certificate download button**: appears automatically once a course hits 100%
- **Toggle any section on or off**: hide lessons, topics, quizzes, the percentage, the quiz score, or the certificate button independently, or switch to a compact view with no lesson list
- **Animated progress bar and circles** on page load
- **Modern UI Design**: Professional card-based layout with enhanced visual hierarchy
- **Pill-Style Progress Stats**: Clean, readable progress indicators for lessons, topics, and quizzes
- **Enhanced Progress Circles**: Refined visual progress indicators with improved styling
- **Improved Admin Interface**: Modern form styling with better focus states and responsive design
- Customizable general color to match your brand
- Responsive design: mobile, tablet, and desktop-friendly
- Lightweight and performance-optimized
- Compatible with all major LearnDash themes and templates

🚀 **How to Use**
1. Install and activate the plugin.
2. Go to **LearnDash LMS > Progress Settings**.
3. Choose your preferred general color.
4. Add the progress card using whichever method fits your workflow:
   - **Shortcode**: `[swrldcp_course_progress course_id=123]` in any page, post, or Classic Widget.
   - **Gutenberg block**: search for "Swr Course Progress" in the block inserter, then pick a course from the dropdown.
   - **Sidebar widget**: add "LearnDash Course Progress" from Appearance > Widgets.
   - **Elementor**: drag in the "Swr Course Progress" widget (shown when Elementor is active).
   - **Divi**: add the "Swr Course Progress" module from the Divi Builder (shown when Divi is active).
5. Leave the course out (or use the "All my courses" option) to show a dashboard of every course the logged-in student is enrolled in, or drop the shortcode/block/widget directly on a course, lesson, topic, or quiz page to auto-detect that course.

🎛️ **Shortcode Attributes**

`[swrldcp_course_progress course_id=123 show_lessons=no show_topics=no show_quizzes=no show_percentage=no show_quiz_score=no show_certificate=no show_lesson_list=no compact=yes]`

- `course_id` — the course to display. Leave out to auto-detect or show the "All My Courses" dashboard.
- `user_id` — defaults to the logged-in user.
- `show_stats` — toggle the entire row of stat pills at once (`yes`/`no`).
- `show_lessons` / `show_topics` / `show_quizzes` — toggle each individual stat pill (`yes`/`no`).
- `show_percentage` — toggle the big percentage number (`yes`/`no`).
- `show_quiz_score` — toggle the average quiz score pill (`yes`/`no`).
- `show_certificate` — toggle the certificate download button shown at 100% (`yes`/`no`).
- `show_lesson_list` — toggle the full lesson checklist below the stats (`yes`/`no`).
- `compact` — `yes` hides the lesson list for a shorter card, ideal for widgets and sidebars.
- `columns` — number of course cards per row (1-6, default 2) in the "All My Courses" dashboard. Has no effect when a specific `course_id` is shown.

The Gutenberg block, sidebar widget, Elementor widget, and Divi module all expose the same options as controls/toggles — no shortcode typing required.

That’s it! Your course progress will now display in a clean, visual format.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/swr-course-progress-for-learndash/` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to **LearnDash LMS > Progress Settings** to configure your general color and get the shortcode.
4. Add the progress card with the shortcode, the Gutenberg block, the sidebar widget, or (if active) the Elementor widget or Divi module.

== Frequently Asked Questions ==

= Can I show progress for multiple courses? =  
Yes, simply use the shortcode multiple times with different course IDs.

= Does the plugin work with all LearnDash themes? =  
Yes, the plugin is designed to be compatible with all major LearnDash themes and templates.

= Is this plugin mobile responsive? =
Absolutely. The progress bar layout adjusts to fit all screen sizes.

= Do I need Elementor or Divi installed to use this plugin? =
No. The shortcode, Gutenberg block, and sidebar widget work with any theme out of the box. The Elementor widget and Divi module are optional extras that only appear when you already have Elementor or Divi active — they don't add any requirement on their own.

= What happens if I don't set a course_id? =
On a course, lesson, topic, or quiz page, the plugin automatically shows progress for that course. Anywhere else, it shows a dashboard of every course the logged-in student is enrolled in.

= How do Group Leaders see their students' progress? =
Once a user is set up as a LearnDash Group Leader (or is a site administrator), a new "Progress Reports" menu appears in their WordPress admin, showing a table of every student's percentage progress across each course in their group(s).

= Why don't I see a quiz score or a certificate button? =
The average quiz score pill only appears once the student has actually attempted a quiz in that course. The certificate download button only appears once the course reaches 100% completion and a certificate has been assigned to that course under LearnDash's course settings.

= Can I hide parts of the progress card? =
Yes — see the Shortcode Attributes section above. Every stat (lessons, topics, quizzes, percentage, quiz score, certificate, lesson list) can be toggled independently, and the same toggles are available as controls on the block, widget, Elementor widget, and Divi module.

== Screenshots ==
1. Admin settings page to customize colors
2. Frontend course progress bar
3. The Gutenberg block with its course-picker dropdown
4. The Group Leader / Admin Progress Reports dashboard
5. The certificate download button at 100% completion

== Changelog ==

= 1.2.2 =
* Added: Gutenberg block ("Swr Course Progress") with a course-picker dropdown and a live editor preview that always matches the frontend.
* Added: Sidebar widget ("LearnDash Course Progress") with the same options as the shortcode.
* Added: Elementor widget and Divi module (both named "Swr Course Progress"), shown automatically when Elementor or Divi is active — neither is required otherwise.
* Added: Auto course-ID detection — the shortcode/block/widget detect the current course from a course, lesson, topic, or quiz page when no course_id is given.
* Added: "All My Courses" dashboard view, shown when no course_id is given or detectable, laid out with a configurable number of cards per row (`columns` attribute, 1-6, default 2 — falls back to one column on narrow screens).
* Added: Group Leader / Admin "Progress Reports" dashboard showing every student's progress across their group's courses, with color-coded percentage badges and pagination (10 groups per page).
* Added: Average quiz score display (based on each quiz's best attempt).
* Added: Certificate download button, shown automatically once a course reaches 100%.
* Added: New shortcode attributes to toggle sections — `show_lessons`, `show_topics`, `show_quizzes`, `show_percentage`, `show_stats`, `show_quiz_score`, `show_certificate`, `show_lesson_list`, `compact`, `columns`.
* Added: Load-in animation for the progress bar and per-lesson progress circles.
* Improved: Course title in the progress card now links to the course page.
* Improved: The shortcode, block, widget, Elementor widget, and Divi module all share one rendering engine, so a change made once is reflected identically everywhere.
* Improved: Redesigned the Progress Settings admin page — a clearer Quick Start card with copy-to-clipboard shortcode examples and a one-attribute-per-line reference, and a separate Appearance card for the color/width settings.
* Fixed: The Elementor widget's Show Lessons / Show Topics / Show Quizzes / Show Percentage / Show Quiz Score / Show Certificate toggles had no effect. Elementor's switch control reports an empty value (not the word "no") when switched off; the widget's settings mapping now accounts for that.

= 1.2.1 =
* Fixed: Removed the `Requires Plugins: sfwd-lms` header — LearnDash is not distributed on WordPress.org, so this caused an "Invalid plugin dependencies" warning. The existing runtime check (admin notice if LearnDash is inactive) still works as before.

= 1.2 =
* Improved: SEO-optimized plugin description and tags for better discoverability.
* Improved: Frontend CSS/JS now load only on pages/posts that actually use the shortcode, for better page speed.
* Improved: Stricter validation on the Container Width setting to prevent invalid CSS values.
* Fixed: An invalid General Color value could be saved as empty, breaking the progress bar styling.
* Fixed: The "Settings saved successfully" message could appear even when a field failed validation.
* Added: Native LearnDash dependency check (`Requires Plugins` header) for a cleaner install experience.
* Added: Plugin options are now removed automatically on uninstall.

= 1.0 =
* Initial release with shortcode support and color customization.

== Upgrade Notice ==

= 1.2.2 =
Adds a Gutenberg block, widget, Elementor/Divi support, group reporting, quiz scores, certificates, a configurable "All My Courses" dashboard, and new shortcode attributes. Safe to update.

= 1.2.1 =
Fixes an invalid plugin-dependency header from 1.2. Safe to update.

= 1.2 =
Performance, validation, and cleanup improvements. Safe to update.

= 1.0 =
* Initial release with shortcode support and color customization.

== Support ==

Need help or have questions? Our dedicated support team is here to help you make the most of this plugin. https://swrice.com/contact-us/