=== Marivya Lesson Planner ===
Contributors: marivya
Tags: tutor, lessons, calendar, portal, recurring
Requires at least: 6.3
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.7.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lesson planner for tutors: students, recurring lessons, materials, calendar, reminders and a simple student portal.

== Description ==

**Marivya Lesson Planner** helps tutors, private teachers, language teachers and coaches manage students, lessons and shared materials inside WordPress.

It includes a simple **Student Portal** that students can open via a **magic link** or **PIN**, so they can see upcoming lessons and notes without creating WordPress accounts.

**Highlights**
- Manage **Students**, **Lessons**, and **Materials** as dedicated WordPress admin screens.
- Create **recurring lesson copies** from one lesson: weekly, every 2 weeks, or monthly.
- Use lesson fields for date, time, duration, status, meeting link, notes and homework.
- Move lessons in the weekly calendar with drag and drop.
- Attach materials to a student or keep them global.
- Give students portal access via magic link or PIN.
- Send teacher email reminders and export upcoming lessons as an ICS calendar file.
- WordPress privacy integration: personal data **exporter** and **eraser**.
- No telemetry. No external services required.

**Simple recurring lessons are included in the free version.** A future Pro add-on may add advanced recurring rules, student reminders, billing helpers and a richer portal.

> This plugin is independent and not affiliated with any LMS vendor.

= How it works =
1. Create a **Student**.
2. Add a **Lesson** with date, time and duration.
3. In the lesson editor, use **Repeat lesson** to create future weekly, biweekly or monthly lesson copies.
4. Optionally attach **Materials** to the student.
5. Open a student and use the **Student Portal access** box to generate a magic link or set a PIN.
6. Students access the portal from the link or by PIN. A secure session cookie keeps them logged in for 30 days.

= Privacy =
- Includes a **personal data exporter** and **eraser** (`Tools → Export/Erase Personal Data`).
- Student portal session cookie: `marivya_lp_portal` (HTTP-only, SameSite=Lax, Secure on HTTPS), expires in 30 days.
- Magic links expire after a chosen number of days (default 7).
- No personal data is sent to third parties.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/marivya-lesson-planner/` directory or install via **Plugins → Add New**.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. A **Student Portal** page is created automatically (you can change the URL later).
4. Go to **Students** and create your first student.
5. Add one lesson or create a recurring lesson series from the lesson editor.

== Frequently Asked Questions ==

= Can I create recurring lessons in the free version? =
Yes. Open or create a lesson, set its date and time, then use the **Repeat lesson** box. You can create weekly, every-2-weeks or monthly copies. Existing matching lessons for the same student, date and time are skipped.

= Does recurring editing change the whole series later? =
No. The free recurring feature creates future lesson copies once. Each generated lesson can then be edited independently.

= How do I send a magic link to a student? =
Open a **Student** in the admin and use the **Student Portal access** box to generate and copy the link, or send it via email from the same screen.

= Can I use a PIN instead of a link? =
Yes. Set a PIN in the same **Student Portal access** box. PIN attempts are rate-limited and the PIN is stored as a hash.

= Where is the portal page URL set? =
A portal page is created on activation. You can change the base URL used in student access links in **Marivya Lesson Planner → Settings → Student Portal**.

= Does the plugin add a frontend login or user accounts? =
No. Students access their portal via a time-limited token link or a PIN; no WP user accounts are created.

= How do I export or erase personal data? =
Use WordPress tools: **Tools → Export Personal Data** / **Tools → Erase Personal Data**. The plugin registers its own exporter/eraser.

= Does uninstall remove all data? =
By default, options and sensitive portal metadata are removed, while CPT content (students/lessons/materials) is preserved.
You can force full removal via:
`define( 'MARIVYA_LP_DELETE_ALL_DATA_ON_UNINSTALL', true );`
or by hooking:
`add_filter( 'marivya_lp_uninstall_remove_content', '__return_true' );`

== Screenshots ==
1. Students list and student edit screen.
2. Lesson editor with date/time/duration and the free Repeat lesson box.
3. Materials attached to a student.
4. Student Portal access (magic link / PIN).
5. Calendar view (moving lessons via drag and drop).
6. Student Portal (student view).

== Changelog ==

= 1.7.3 =
* Fixed Plugin Check findings: sanitized input handling, recurring lesson nonce checks and translator comment.
* Kept the refreshed student portal styling and improved front-end consistency.
* Removed a duplicate-check query pattern flagged by VIP performance rules.

= 1.7.2 =
* Refreshed the student portal UI to match the new plugin style more closely.
* Improved the portal hero area, navigation tabs, lesson cards, homework cards, materials cards and PIN login form.
* Added compact student portal stats for a cleaner and more app-like front-end experience.

= 1.7.1 =
* Kept Marivya plugin screens in English even when the WordPress dashboard language is different.
* Fixed the student list filters so the empty student tag dropdown is no longer shown when there are no tags.
* Improved status labels and list column labels for a cleaner English admin experience.

= 1.7.0 =
* Full admin UI refresh for a more cohesive visual style across plugin screens.
* Unified styling for dashboard, settings, planning, notifications, list screens and edit screens.
* Keeps the refreshed weekly calendar and extends the same design language to the rest of the plugin.

= 1.6.0 =
* Refreshed the weekly calendar UI with a cleaner banner-inspired layout inside WordPress admin.
* Added a right sidebar with selected lesson details and quick actions.
* Improved lesson cards, colors and calendar controls for better screenshots and easier scanning.

= 1.5.0 =
* Added free recurring lesson creation from the lesson editor: weekly, every 2 weeks or monthly.
* Added duplicate skipping for generated recurring lessons.
* Added recurring metadata registration and validation.
* Updated readme copy to highlight tutors, recurring lessons and the student portal.

= 1.4.3 =
* Removed accidental SVN/trunk files from the installable plugin package.
* Added centralized validation for dates, times, durations, statuses, URLs and portal PINs.
* Hardened calendar AJAX so only Lesson posts can be moved and invalid date/time input is rejected.
* Improved portal token storage cleanup, portal URL validation and PIN validation.
* Improved frontend date formatting, privacy exporter/eraser coverage and global material visibility.

= 1.4.2 =
* Improved WordPress compatibility (standard i18n loading, clearer security/permissions messages).
* Portal link now uses your saved Portal URL setting.
* Portal "page created" notice is shown once after activation.

= 1.4.1 =
* Fix: calendar navigation and AJAX config.
* New: click an empty calendar slot to create a lesson (prefills date/time + student).
* New: student filter in weekly calendar.
* Improved: status styling in calendar (planned/done/cancelled).
* Improved: notification scheduling uses site timezone; added “send to teacher email”; ICS export includes student name + meeting URL.
* New: Student Portal URL setting.
* Hardening: improved sanitization for emails/URLs.

= 1.0.0 =
* Initial public release.
* Students, Lessons, Materials CPTs.
* Student Portal with magic link and PIN.
* AJAX endpoints for calendar events and moving lessons.
* Privacy exporter/eraser integration.
* Gentle Pro upsell.

== Upgrade Notice ==

= 1.5.0 =
Adds free recurring lesson creation: create weekly, biweekly or monthly lesson copies from the lesson editor.

= 1.4.3 =
Security and cleanup release: stronger validation, safer calendar AJAX, cleaned ZIP packaging, and improved portal/privacy handling.

= 1.4.2 =
WordPress-compatibility hardening + cleaner admin messages. Portal link uses the saved Portal URL.

= 1.4.1 =
Calendar fixes + student filter, improved notifications timezone handling, and portal URL setting.

= 1.0.0 =
First public release of Marivya Lesson Planner.
