Invite creation broken: us_invites schema migration never ran (missing USC_VERSION bump) #87

Closed
opened 2026-07-22 14:34:50 +00:00 by thatguygriff · 0 comments
Owner

Regression from #77 / PR #83.

Creating a personal invite no longer works: the invite doesn't appear under Pending Invites and the generated registration link is rejected as invalid.

Root cause

PR #83 added kind and expires_at columns to us_invites (Schema.php) and InviteRepository::insert() now writes them — but USC_VERSION stayed at 1.0.0-rc.2, so Plugin::boot()'s version check never re-ran Installer/dbDelta. On upgraded sites the table lacks the new columns, wpdb->insert fails silently, no row is stored, and RegistrationController still displays a registration link whose token hash was never persisted.

Fix

  • Bump the plugin Version header and USC_VERSION to 1.0.0-rc.3 so the upgrade path runs dbDelta and adds the columns.
  • Hardening: InviteRepository::insert() must return 0 when the insert fails (not a stale insert_id), and the Invites admin page must show an error notice instead of a dead link when creation fails (personal and group forms).
**Regression from #77 / PR #83.** Creating a personal invite no longer works: the invite doesn't appear under Pending Invites and the generated registration link is rejected as invalid. ## Root cause PR #83 added `kind` and `expires_at` columns to `us_invites` (Schema.php) and `InviteRepository::insert()` now writes them — but `USC_VERSION` stayed at `1.0.0-rc.2`, so `Plugin::boot()`'s version check never re-ran `Installer`/`dbDelta`. On upgraded sites the table lacks the new columns, `wpdb->insert` fails silently, no row is stored, and `RegistrationController` still displays a registration link whose token hash was never persisted. ## Fix - Bump the plugin `Version` header and `USC_VERSION` to `1.0.0-rc.3` so the upgrade path runs dbDelta and adds the columns. - Hardening: `InviteRepository::insert()` must return 0 when the insert fails (not a stale `insert_id`), and the Invites admin page must show an error notice instead of a dead link when creation fails (personal and group forms).
thatguygriff added the bug label 2026-07-22 14:34:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#87