Fix - Deactivate Licence button did nothing when the pro-activation transient was set - #1418
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is a minimal, targeted removal of an unconditional early return that was preventing the intended deactivation flow from executing.
Pull request overview
Fixes a license-deactivation no-op on the License settings page by ensuring UR_Plugin_Updater::deactivate_license() always runs its normal deactivation flow, even when the user_registration_pro_activated transient is present.
Changes:
- Removed an early-return guard in
deactivate_license()that skipped deactivation wheneveruser_registration_pro_activatedwas set.
File summaries
| File | Description |
|---|---|
| includes/class-ur-plugin-updater.php | Removes a transient-based early return so license deactivation proceeds and clears stored license state as expected. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Reported symptom (#1530): the License settings page shows a Deactivate License button with blank License Plan / License Expiry fields, and clicking Deactivate sometimes does nothing — leaving the customer stuck, unable to get back to an input field to enter a fresh license key.
The issue's own diagnosis (inconsistent
user-registration_license_keyvsuser_registration_license_keyoption naming) does not hold up under inspection:includes/admin/settings/class-ur-settings-license.phpuses the hyphenated key consistently everywhere it matters. The one underscore-variant reference (includes/admin/notifications/class-ur-admin-notices.php:496) is an unrelated survey-notice display condition and does not touch this page.Root cause, confirmed by reproduction:
UR_Plugin_Updater::deactivate_license()(includes/class-ur-plugin-updater.php:449-452) early-returned whenever theuser_registration_pro_activatedtransient was set. That transient is set once when the Pro plugin is activated (user-registration.php:744) and is only cleared insideuser_registration_free_deactivate(), hooked on the sameadmin_initpass at the same default priority as this class's ownadmin_inithook — a hook-ordering race where this guard's read runs before that request's clear. In practice the very first Deactivate click after Pro was ever activated always no-ops, and the stale_license_keyoption is never cleared, which is also why the License Plan/Expiry fields stay blank and the input never comes back.This is the same underlying mechanism already reported against #1531. Removed the 4-line guard so
deactivate_license()always runs its normal deactivation flow.Closes #1530.
How to test the changes in this Pull Request:
user_registration_pro_activatedtransient exists) and a license key option set, go to Settings → License.wp eval) on a local Pro install: setuser-registration_license_key+ theuser_registration_pro_activatedtransient, calleddeactivate_license()— option was unchanged before the fix, cleared after.Types of changes:
Other information:
PHPCS:
composer phpcson the changed file aborted partway on a pre-existing environment issue (theWordPress.NamingConventions.PrefixAllGlobalssniff crashes under the current PHP'strim()deprecation, unrelated to this repo). The 2 findings it surfaced before aborting are both pre-existing and outside the touched lines (a repo-wide CRLF line-ending flag, and an indentation flag on an unrelated commented-out line).Changelog entry