Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 5 weeks ago

#13760 closed defect (bug) (fixed)

Unused validation in wpmu_activate_signup

Reported by: filosofo Owned by:
Priority: normal Milestone: 3.0
Component: Multisite Version: 3.0
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

wpmu_activate_signup calls wpmu_validate_user_signup without acting on its response.

Patch returns errors, if any are generated by wpmu_validate_user_signup. Otherwise, it uses the username and email as validated by wpmu_validate_user_signup.

Attachments (1)

use-wpmu_validate_user_signup.13760.diff​ (739 bytes ) - added by filosofo 16 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ryan
16 years ago

The call to wpmu_validate_blog_signup() is the same way.

#3 @ryan
16 years ago

Looks like the validation is done in validate_user_signup() and validate_blog_signup() in wp-signup.php. Does wp_activate_signup() really need to run these again, or can it assume what is pulled from the DB is safe?

#4 @wpmuguru
16 years ago

That patch doesn't work. When it's applied activation fails indicating that the username has already been reserved.

For now, I'm removing the validate calls for both users & sites. I'll leave teh ticket open for patches if someone wants to provide one.

#5 @wpmuguru
16 years ago

(In [15186]) removed unused validation from activation process, see #13760

#6 @ryan
16 years ago

  • Resolution → fixed
  • Status new → closed

Let's call it done.

This ticket was mentioned in ​PR #13921 on ​WordPress/wordpress-develop by ​@algorithmsunlocks.


5 weeks ago
#7

  • Keywords has-unit-tests added

Summary

Prevents offering "Activate" or "Network Activate" links after uploading a plugin that has unmet dependency requirements. Shows an error notice explaining why activation is not available, improving user experience when plugin dependencies are missing.

Problem

After uploading a plugin, WordPress offered activation links even when the plugin had unmet dependencies (missing required plugins). Clicking the "Activate" link would fail silently or show a cryptic error because activate_plugin() checks for these requirements at activation time.

Users had no indication during the upload/install process that the plugin couldn't be activated due to missing dependencies.

Solution

Check the plugin's requirements using validate_plugin_requirements() after upload. If requirements are unmet:

  1. Hide the "Activate" and "Network Activate" links
  2. Display an error notice explaining which plugin dependency is missing

This gives immediate feedback during the installation process, rather than at the activation step.

Changes

  • src/wp-admin/includes/class-plugin-installer-skin.php: Added dependency validation and error notice
  • tests/phpunit/tests/admin/pluginInstallerSkin.php: New test file with 2 test cases

Testing

✅ Tests added: 2 test methods

  • test_should_not_offer_activation_when_plugin_has_unmet_dependencies() — Verifies no activation links when dependencies missing
  • test_should_offer_activation_when_plugin_has_no_dependencies() — Verifies activation links still work normally

✅ Test results:

  • --group 66184: 2/2 pass (new test file)
  • Tests_Admin_PluginInstallerSkin: 2 pass
  • PHPCS: clean
  • PHP compatibility: clean

✅ Manual test:

  • Uploaded a plugin with unmet dependencies
  • Verified "Activate" link was not offered
  • Verified error notice was displayed with missing plugin name
  • Uploaded a plugin without dependencies
  • Verified "Activate" link was offered normally

Compatibility

Works with plugin dependency system added in WordPress 6.5.

Builds on #13760 (plugin dependencies feature).

---

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5, Claude Haiku 4.5
Used for: Understanding the plugin dependency system and writing tests that simulate plugin uploads with and without unmet requirements.

🤖 Generated with ​Claude Code

​@algorithmsunlocks commented on ​PR #13921:


5 weeks ago
#8

@huzaifaalmesbah thanks, added test_should_not_offer_activation_when_required_plugin_is_inactive() to PR ​https://github.com/WordPress/wordpress-develop/pull/13921, also rebased on current trunk. --group 66184 (3 tests): 2 fail on trunk, 3/3 pass with the patch on single site and multisite; --group plugins (156 tests) passes.

Note: See TracTickets for help on using tickets.