A parent registers once and manages lessons for one or more children, who need no login of their own. A child is a real wp_users row with the student role but no usable login — so student_id keeps meaning "a WordPress user" on every table, and booking, credits, policies and enrolments work unchanged. A us_guardians link table maps guardian to child. The signup form gains a parent/guardian tick that reveals a block per child, with the account-signup questions asked per child rather than per guardian — they describe the student, not the account holder. Signup policies are recorded once per child with the guardian as the acceptor, which is the record that actually means something. A family that half-creates is rolled back entirely rather than leaving a guardian who cannot re-register. The booking and enrolment forms gain a "Who is this for?" picker listing children first, so the default selection is never the parent — booking for the wrong child is correctable, quietly billing a parent for their kid's lesson is not. POST /bookings and POST /enrollments take an optional student_id honoured only for that child's guardian; anything else is a 403. That check is the authorisation boundary of the feature. Payments and credits gain a payer: the charge names the child it was for and the guardian who owes it, so per-child reporting is unchanged while notices, receipts and the payment step reach the parent. Credit is held by the payer, so one child's cancellation can settle a sibling's charge, and the daily billing scan sends a guardian one notice covering every child. Closes #132 Co-Authored-By: Claude Opus 5 <[email protected]>
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: Unsupervised Scheduler
|
|
* Plugin URI: https://git.unsupervised.ca/Unsupervised/unsupervised-scheduler
|
|
* Description: Instructor/student lesson scheduling for WordPress.
|
|
* Version: 1.3.0
|
|
* Requires at least: 6.2
|
|
* Requires PHP: 8.1
|
|
* Author: Unsupervised
|
|
* Author URI: https://unsupervised.ca
|
|
* License: GPL-2.0-or-later
|
|
* Text Domain: unsupervised-schedular
|
|
* Update URI: https://git.unsupervised.ca/Unsupervised/unsupervised-scheduler
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Unsupervised\Schedular;
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
define('USC_VERSION', '1.3.0');
|
|
define('USC_PLUGIN_FILE', __FILE__);
|
|
define('USC_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
define('USC_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
define('USC_TABLE_AVAILABILITY', $GLOBALS['wpdb']->prefix . 'us_availability');
|
|
define('USC_TABLE_LESSONS', $GLOBALS['wpdb']->prefix . 'us_lessons');
|
|
|
|
require_once USC_PLUGIN_DIR . 'vendor/autoload.php';
|
|
|
|
register_activation_hook(__FILE__, static function (): void {
|
|
(new Installer())->run();
|
|
});
|
|
|
|
register_deactivation_hook(__FILE__, static function (): void {
|
|
wp_clear_scheduled_hook('us_generate_due_payments');
|
|
flush_rewrite_rules();
|
|
});
|
|
|
|
add_action('plugins_loaded', static function (): void {
|
|
Plugin::boot();
|
|
});
|