Show "Booked by" in the Account section of a student's detail page
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 2m48s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m42s
CI / Tests (PHP 8.2) (pull_request) Successful in 57s
CI / Tests (PHP 8.1) (pull_request) Successful in 59s
CI / Coding Standards (pull_request) Successful in 3m1s
CI / Build Plugin Zip (pull_request) Skipped

The parent/guardian was only named further down under Profile, where it
reads as background rather than as an account fact, and only when there
was one — so a page with no such line was ambiguous between "books for
themselves" and "the lookup found nothing".

It now sits in the Account table beside display name and email, as the
guardian's name linked to their own detail page, and always renders: a
student who books for themselves says so outright. No email address —
theirs is one click away on their own page, and repeating it here only
makes the row harder to scan. The Profile section keeps only the note
explaining the placeholder email, which is a different point.

Tests: composer test (863), composer lint, composer cs all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-07-30 12:18:42 -03:00
co-authored by Claude Opus 5
parent c9a1205fc0
commit 122f7a0f53
3 changed files with 27 additions and 12 deletions
+1
View File
@@ -16,6 +16,7 @@ each change under the current top section as you work.
### Added ### Added
- **Group classes now appear in "Your upcoming lessons".** A class is stored as a term rather than as bookable slots, so nothing that listed lessons could ever show one — a student whose whole term was a group class saw an empty schedule, and an instructor teaching one saw nothing on their My Lessons page. Each remaining session of a class you are enrolled in now sorts in among your lessons by date, labelled **group class**; instructors see every session of the classes they teach, one row per session however many students are in it. A session has no Cancel button, because there is no such thing as cancelling one date of a term — withdrawing from the class is still done from the class page. - **Group classes now appear in "Your upcoming lessons".** A class is stored as a term rather than as bookable slots, so nothing that listed lessons could ever show one — a student whose whole term was a group class saw an empty schedule, and an instructor teaching one saw nothing on their My Lessons page. Each remaining session of a class you are enrolled in now sorts in among your lessons by date, labelled **group class**; instructors see every session of the classes they teach, one row per session however many students are in it. A session has no Cancel button, because there is no such thing as cancelling one date of a term — withdrawing from the class is still done from the class page.
- A class you are enrolled in shows up **whether or not its schedule is pinned to a clock**. Class time and duration are both optional on the offering form, and the schedule note is there so a studio can simply write "Tuesdays 4:00pm" — so a class with a time but no duration lists its dates and says when each session starts rather than guessing when it ends, and a class with no time at all gets a single row carrying its schedule note (or its term dates) where the time would go. Only a class whose last day has passed drops off the list. - A class you are enrolled in shows up **whether or not its schedule is pinned to a clock**. Class time and duration are both optional on the offering form, and the schedule note is there so a studio can simply write "Tuesdays 4:00pm" — so a class with a time but no duration lists its dates and says when each session starts rather than guessing when it ends, and a class with no time at all gets a single row carrying its schedule note (or its term dates) where the time would go. Only a class whose last day has passed drops off the list.
- A student's admin detail page now shows **Booked by** in the Account section — the name of the parent or guardian who books and pays for them, linked to their own page. It was only stated further down under Profile, and only when there was one; the row is now always there, saying in words when a student books for themselves.
- The same group-class sessions now appear in **Upcoming lessons** on a student's admin detail page, so one table answers "what are they booked into next week?". Only upcoming ones — the **Group-class enrolments** table below already holds the history. - The same group-class sessions now appear in **Upcoming lessons** on a student's admin detail page, so one table answers "what are they booked into next week?". Only upcoming ones — the **Group-class enrolments** table below already holds the history.
- **A policy can be renamed.** The title was fixed at creation, so a typo or a change of wording meant creating a second policy and re-collecting everyone's acceptance. Renaming changes only what students read above the policy text: the slug stays put, so every version already accepted stays attached. - **A policy can be renamed.** The title was fixed at creation, so a typo or a change of wording meant creating a second policy and re-collecting everyone's acceptance. Renaming changes only what students read above the policy text: the slug stays put, so every version already accepted stays attached.
+5 -1
View File
@@ -24,7 +24,11 @@ No new tables. The views are composed from existing data:
quick counts (upcoming lessons, active group enrolments). Each row links to the quick counts (upcoming lessons, active group enrolments). Each row links to the
detail view. detail view.
- **Detail** (`?student_id=`): - **Detail** (`?student_id=`):
- **Account** — display name, email, registered date. - **Account** — display name, email, registered date, and **Booked by**: the
name of the parent/guardian who books and pays for this student, linked to
their own detail page. Always rendered — a student who books for themselves
says so in words, so an empty row can never be mistaken for a lookup that
failed.
- **Upcoming lessons** and **Past lessons** — split by the linked availability - **Upcoming lessons** and **Past lessons** — split by the linked availability
slot's `start_dt`; each shows date/time, offering, instructor, and status. slot's `start_dt`; each shows date/time, offering, instructor, and status.
**Upcoming lessons** also lists the student's upcoming group-class sessions **Upcoming lessons** also lists the student's upcoming group-class sessions
+21 -11
View File
@@ -114,6 +114,8 @@ $renderLessons = static function (array $rows, bool $withActions = false): void
<div class="notice notice-error is-dismissible"><p><?php echo esc_html($error); ?></p></div> <div class="notice notice-error is-dismissible"><p><?php echo esc_html($error); ?></p></div>
<?php endif; ?> <?php endif; ?>
<?php $detailUrl = static fn(int $id): string => add_query_arg(['page' => $pageSlug, 'student_id' => $id], admin_url('admin.php')); ?>
<h2><?php esc_html_e('Account', 'unsupervised-schedular'); ?></h2> <h2><?php esc_html_e('Account', 'unsupervised-schedular'); ?></h2>
<form method="post"> <form method="post">
<?php wp_nonce_field('usc_student_actions'); ?> <?php wp_nonce_field('usc_student_actions'); ?>
@@ -131,24 +133,32 @@ $renderLessons = static function (array $rows, bool $withActions = false): void
<th><?php esc_html_e('Registered', 'unsupervised-schedular'); ?></th> <th><?php esc_html_e('Registered', 'unsupervised-schedular'); ?></th>
<td><?php echo esc_html($student->user_registered); ?></td> <td><?php echo esc_html($student->user_registered); ?></td>
</tr> </tr>
<?php
/*
* Always rendered, both ways round. "Books for themselves" is a fact
* worth stating outright: an empty row would be indistinguishable
* from a guardian the page failed to look up.
*/
?>
<tr>
<th><?php esc_html_e('Booked by', 'unsupervised-schedular'); ?></th>
<td>
<?php if ($guardian !== null) : ?>
<?php // The name alone. Their address is one click away on their own page, and repeating it here only makes the row harder to scan. ?>
<a href="<?php echo esc_url($detailUrl($guardian['id'])); ?>"><?php echo esc_html($guardian['name']); ?></a>
<?php else : ?>
<span class="description"><?php esc_html_e('Nobody — this student books and pays for themselves.', 'unsupervised-schedular'); ?></span>
<?php endif; ?>
</td>
</tr>
</table> </table>
<?php submit_button(esc_html__('Save account details', 'unsupervised-schedular'), 'secondary', 'submit', false); ?> <?php submit_button(esc_html__('Save account details', 'unsupervised-schedular'), 'secondary', 'submit', false); ?>
</form> </form>
<?php if ($guardian !== null || ! empty($children)) : ?> <?php if ($guardian !== null || ! empty($children)) : ?>
<h2><?php esc_html_e('Profile', 'unsupervised-schedular'); ?></h2> <h2><?php esc_html_e('Profile', 'unsupervised-schedular'); ?></h2>
<?php $detailUrl = static fn(int $id): string => add_query_arg(['page' => $pageSlug, 'student_id' => $id], admin_url('admin.php')); ?>
<?php if ($guardian !== null) : ?> <?php if ($guardian !== null) : ?>
<p> <?php // Who they book through is up in Account; this explains the placeholder email. ?>
<?php
printf(
/* translators: 1: linked name of the parent/guardian, 2: their email address. */
esc_html__('Books and pays through %1$s (%2$s).', 'unsupervised-schedular'),
'<a href="' . esc_url($detailUrl($guardian['id'])) . '">' . esc_html($guardian['name']) . '</a>',
esc_html($guardian['email'])
);
?>
</p>
<p class="description"><?php esc_html_e('This is a managed student account: it has no login of its own, and its email address is a placeholder that cannot receive mail.', 'unsupervised-schedular'); ?></p> <p class="description"><?php esc_html_e('This is a managed student account: it has no login of its own, and its email address is a placeholder that cannot receive mail.', 'unsupervised-schedular'); ?></p>
<?php endif; ?> <?php endif; ?>
<?php if (! empty($children)) : ?> <?php if (! empty($children)) : ?>