Add multi-use group invite links with expiry and auto-approval on email confirmation
CI / Tests (PHP 8.2) (pull_request) Successful in 44s
CI / Tests (PHP 8.1) (pull_request) Successful in 46s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m46s
CI / PHPStan (pull_request) Successful in 2m51s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m38s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.2) (pull_request) Successful in 44s
CI / Tests (PHP 8.1) (pull_request) Successful in 46s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m46s
CI / PHPStan (pull_request) Successful in 2m51s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m38s
CI / Build Plugin Zip (pull_request) Skipped
A studio admin can generate a shareable group invite link (e.g. for a newsletter) from the Invites page, choosing a required expiry date. Anyone with the link may register while it is valid, in any registration mode: the form collects their own email, they must confirm it via the usual hashed token, and confirming approves the account immediately — group signups never enter the Pending Students queue. - us_invites grows kind (personal/group) and expires_at; an explicit expiry wins over the personal 14-day window. Group links stay pending (multi-use) until revoked or expired. - RegistrationPage: group signups create the account pending with the us_auto_approve marker and send the confirmation email; no auto-login. - EmailConfirmationHandler: auto-approve accounts are approved on confirmation, emailed the approved notice, and redirected to a new us_confirmed=ready notice with a sign-in link. Closes #77 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -66,6 +66,23 @@ if (! defined('ABSPATH')) {
|
||||
<?php submit_button(esc_html__('Generate Invitation Link', 'unsupervised-schedular')); ?>
|
||||
</form>
|
||||
|
||||
<h2><?php esc_html_e('Group Invite Link', 'unsupervised-schedular'); ?></h2>
|
||||
<p class="description"><?php esc_html_e('Generate a shareable link (e.g. for a newsletter). Anyone with the link can register until it expires: they enter their own email and must confirm it, but no admin approval is needed afterwards.', 'unsupervised-schedular'); ?></p>
|
||||
<form method="post">
|
||||
<?php wp_nonce_field('usc_invite_action'); ?>
|
||||
<input type="hidden" name="usc_action" value="group_invite">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th><label for="expires_at"><?php esc_html_e('Expires on', 'unsupervised-schedular'); ?></label></th>
|
||||
<td>
|
||||
<input type="date" name="expires_at" id="expires_at" required min="<?php echo esc_attr((string) current_time('Y-m-d')); ?>">
|
||||
<p class="description"><?php esc_html_e('The link stops working at the end of this day.', 'unsupervised-schedular'); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php submit_button(esc_html__('Generate Group Link', 'unsupervised-schedular')); ?>
|
||||
</form>
|
||||
|
||||
<h2><?php esc_html_e('Pending Invites', 'unsupervised-schedular'); ?></h2>
|
||||
|
||||
<?php if (empty($pendingInvites)) : ?>
|
||||
@@ -74,8 +91,9 @@ if (! defined('ABSPATH')) {
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e('Email', 'unsupervised-schedular'); ?></th>
|
||||
<th><?php esc_html_e('Invited', 'unsupervised-schedular'); ?></th>
|
||||
<th><?php esc_html_e('Invite', 'unsupervised-schedular'); ?></th>
|
||||
<th><?php esc_html_e('Created', 'unsupervised-schedular'); ?></th>
|
||||
<th><?php esc_html_e('Expires', 'unsupervised-schedular'); ?></th>
|
||||
<th><?php esc_html_e('Actions', 'unsupervised-schedular'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -84,7 +102,7 @@ if (! defined('ABSPATH')) {
|
||||
<?php foreach ($pendingInvites as $invite) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo esc_html($invite->email); ?>
|
||||
<?php echo $invite->isGroup() ? esc_html__('Group link', 'unsupervised-schedular') : esc_html($invite->email); ?>
|
||||
<?php if ($invite->isExpired($now)) : ?>
|
||||
<span class="us-invite-expired" style="color:#b32d2e;">— <?php esc_html_e('expired', 'unsupervised-schedular'); ?></span>
|
||||
<?php endif; ?>
|
||||
@@ -92,6 +110,9 @@ if (! defined('ABSPATH')) {
|
||||
<td>
|
||||
<?php echo esc_html((string) $invite->createdAt); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo esc_html($invite->expiresAt !== null ? (string) mysql2date('M j, Y', $invite->expiresAt) : '—'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" style="display:inline;">
|
||||
<?php wp_nonce_field('usc_invite_action'); ?>
|
||||
|
||||
Reference in New Issue
Block a user