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
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:
@@ -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>
|
||||
<?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>
|
||||
<form method="post">
|
||||
<?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>
|
||||
<td><?php echo esc_html($student->user_registered); ?></td>
|
||||
</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>
|
||||
<?php submit_button(esc_html__('Save account details', 'unsupervised-schedular'), 'secondary', 'submit', false); ?>
|
||||
</form>
|
||||
|
||||
<?php if ($guardian !== null || ! empty($children)) : ?>
|
||||
<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) : ?>
|
||||
<p>
|
||||
<?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>
|
||||
<?php // Who they book through is up in Account; this explains the placeholder email. ?>
|
||||
<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 if (! empty($children)) : ?>
|
||||
|
||||
Reference in New Issue
Block a user