Skip to content

Fix crash in admin_edit_user_link for virtual subscriptions#628

Merged
akirk merged 1 commit intomainfrom
fix/admin-edit-user-link-crash
Mar 27, 2026
Merged

Fix crash in admin_edit_user_link for virtual subscriptions#628
akirk merged 1 commit intomainfrom
fix/admin-edit-user-link-crash

Conversation

@akirk
Copy link
Copy Markdown
Owner

@akirk akirk commented Mar 27, 2026

Summary

  • Fixes Call to a member function has_cap() on false error on the Notification Manager page
  • get_edit_friend_link() used new \WP_User() which doesn't work for virtual subscriptions (introduced in v4.0). Now uses User::get_by_username() to resolve both real users and virtual subscriptions.
  • Added guard in admin_edit_user_link() against failed user lookups returning WP_Error

Fixes #626

Test plan

  • Visit the Notification Manager tab — should render without errors
  • Verify edit links for subscriptions point to the correct edit-friend page

Test in WordPress Playground

Since v4.0 friend users were migrated to virtual subscriptions (taxonomy
terms). get_edit_friend_link() used new \WP_User() which fails for these
virtual subscriptions, and admin_edit_user_link() called has_cap() on the
resulting false/WP_Error value.

- Use User::get_by_username() in get_edit_friend_link() to resolve both
  real users and virtual subscriptions
- Guard against failed user lookups in admin_edit_user_link()
@akirk akirk merged commit d23e9b9 into main Mar 27, 2026
25 checks passed
@akirk akirk deleted the fix/admin-edit-user-link-crash branch March 27, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught Error in WP with v4.0 and v4.0.1

1 participant