WordPress/wp-includes/rest-api/endpoints
hellofromTonya 5584cf60c0 REST API: Remove 'Invalid user ID' error in WP_REST_Users_Controller::update_item().
Removes the `WP_Error` code for `'Invalid user ID.'`. Why?

tl;dr
This branch will never be entered as the `$user` will never be falsey.

Longer reasoning:

[39954] introduced `WP_REST_Users_Controller::get_user()` method to encapsulate getting the user and handling the `'Invalid user ID.'` `WP_Error`. It replaced `get_userdata()` in `WP_REST_Users_Controller::update_item()` but left the existing `'Invalid user ID.'` `WP_Error` introduced in [38832].

The code removed in this changeset will never be reached because `$user` will never be falsey. Rather, `WP_REST_Users_Controller::get_user()` will always return an instance of `WP_Error` or `WP_User`. 

Could the user's ID be falsey?
No. Why? `WP_REST_Users_Controller::get_user()` checks that the user exists, which checks if the ID is falsey.

Therefore, the code can safely be removed.

Follow-up to [39954], [38832].

Props jrf, costdev, hellofromTonya, SergeyBiryukov.
Fixes #56662.
Built from https://develop.svn.wordpress.org/trunk@55325


git-svn-id: http://core.svn.wordpress.org/trunk@54858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-13 23:10:20 +00:00
..
class-wp-rest-application-passwords-controller.php
class-wp-rest-attachments-controller.php
class-wp-rest-autosaves-controller.php
class-wp-rest-block-directory-controller.php
class-wp-rest-block-pattern-categories-controller.php
class-wp-rest-block-patterns-controller.php Docs: Improve documentation for block pattern properties. 2023-02-01 15:02:14 +00:00
class-wp-rest-block-renderer-controller.php
class-wp-rest-block-types-controller.php
class-wp-rest-blocks-controller.php
class-wp-rest-comments-controller.php
class-wp-rest-controller.php
class-wp-rest-edit-site-export-controller.php
class-wp-rest-global-styles-controller.php Editor: Add support for custom CSS in global styles. 2023-02-02 18:52:17 +00:00
class-wp-rest-menu-items-controller.php
class-wp-rest-menu-locations-controller.php
class-wp-rest-menus-controller.php
class-wp-rest-pattern-directory-controller.php Editor: Support the block_types and viewport_width props for remote patterns fetched from Pattern Directory. 2023-02-06 19:40:16 +00:00
class-wp-rest-plugins-controller.php
class-wp-rest-post-statuses-controller.php
class-wp-rest-post-types-controller.php
class-wp-rest-posts-controller.php Query: Add a search_columns argument to control which fields are searched in a search query. 2023-02-07 08:55:18 +00:00
class-wp-rest-revisions-controller.php
class-wp-rest-search-controller.php Docs: Miscellaneous improvements and corrections to docblocks. 2023-02-07 21:21:18 +00:00
class-wp-rest-settings-controller.php
class-wp-rest-sidebars-controller.php Widgets: Preserve classic sidebars when switching to a block theme. 2023-02-03 00:15:21 +00:00
class-wp-rest-site-health-controller.php
class-wp-rest-taxonomies-controller.php
class-wp-rest-templates-controller.php REST API: Support non-Latin characters in template route regex. 2023-02-07 23:47:23 +00:00
class-wp-rest-terms-controller.php
class-wp-rest-themes-controller.php
class-wp-rest-url-details-controller.php
class-wp-rest-users-controller.php REST API: Remove 'Invalid user ID' error in WP_REST_Users_Controller::update_item(). 2023-02-13 23:10:20 +00:00
class-wp-rest-widget-types-controller.php
class-wp-rest-widgets-controller.php