WordPress/wp-admin
Boone Gorges a7e229637e Improve validation of user_login and user_nicename length.
The `user_login` field only allows 60 characters, and `user_nicename` allows
50. However, there are no protections in the interface, and few in the code,
that prevent the creation of users with values in excess of these limits. Prior
to recent changes in `$wpdb`, users were generally created anyway, MySQL
having performed the necessary truncation. More recently, the `INSERT`s and
`UPDATE`s simply fail, with no real feedback on the nature of the failure.

This changeset addresses the issue in a number of ways:
* On the user-new.php and network/user-new.php panels, don't allow input in excess of the maximum field length.
* In `wp_insert_user()`, throw an error if the value provided for `'user_login'` or `'user_nicename'` exceeds the maximum field length.
* In `wp_insert_user()`, when using `'user_login'` to generate a default value for `'user_nicename'`, ensure that the nicename is properly truncated, even when suffixed for uniqueness (username-2, etc).

Props dipesh.kakadiya, utkarshpatel, tommarshall, boonebgorges.
Fixes #33793.
Built from https://develop.svn.wordpress.org/trunk@34218


git-svn-id: http://core.svn.wordpress.org/trunk@34182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 22:14:26 +00:00
..
css Comments: Fix inline edit/reply on small screens. 2015-09-13 12:47:27 +00:00
images Squish that .png a bit more. See [32994]. 2015-06-30 22:04:25 +00:00
includes Implement wp_login_url() and wp_registration_url() in places where wp-login.php is currently hard-coded. 2015-09-15 17:11:35 +00:00
js Similar to #33386, don't use guid when retrieving URL for a cropped header image in the Customizer. 2015-09-15 14:46:32 +00:00
maint Improve the tone of key/salts recommendation message. 2015-07-01 15:39:26 +00:00
network Improve validation of user_login and user_nicename length. 2015-09-15 22:14:26 +00:00
user Ensure the requires for the admin bootstrap are documented in all wp-admin/user/ files. 2014-11-04 16:32:22 +00:00
about.php About: Remove period from placeholder. 2015-09-11 19:27:24 +00:00
admin-ajax.php Pinking shears. 2015-08-17 21:39:25 +00:00
admin-footer.php Add @global annotations for wp-admin/*. 2015-05-28 21:41:30 +00:00
admin-functions.php
admin-header.php Correct the title used on the user dashboard. 2015-06-24 00:37:28 +00:00
admin-post.php Introduce wp_validate_action( $action = '' ), a helper function that checks $_REQUEST for action and returns it, or empty string if not present. If $action is passed, it checks to make sure they match before returning it, or an empty string. Strings are always returned to avoid returning multiple types. 2015-09-11 21:08:26 +00:00
admin.php Introduce wp_validate_action( $action = '' ), a helper function that checks $_REQUEST for action and returns it, or empty string if not present. If $action is passed, it checks to make sure they match before returning it, or an empty string. Strings are always returned to avoid returning multiple types. 2015-09-11 21:08:26 +00:00
async-upload.php Don't ever use the guid value when retrieving URLs for media, use wp_get_attachment_url(). Use get_attached_file() for path to file. 2015-09-15 02:50:25 +00:00
comment.php wp_unspam_comment() can accept a full object instead of comment_ID to reduce cache/db lookups.. 2015-09-14 21:47:25 +00:00
credits.php Move ad hoc functions from wp-admin/credits.php to wp-admin/includes/credits.php, which is only included by the former. 2015-09-11 04:55:26 +00:00
custom-background.php Proper heading for admin screens. 2015-06-27 15:41:25 +00:00
custom-header.php Similar to #33386, don't use guid when retrieving URL for a cropped header image in the Customizer. 2015-09-15 14:46:32 +00:00
customize.php Customize: Remove redundant aria-label attributes. 2015-09-13 06:16:26 +00:00
edit-comments.php In the edit-comments.php admin handler, toggle wp_defer_comment_counting() so that only unique post IDs have their comment count updated. Currently, if you delete 50 comments from the same post, the count would get reset 50 times. Not joking. 2015-09-14 22:24:26 +00:00
edit-form-advanced.php Create a function, get_preview_post_link(), to DRY the logic for applying the 'preview_post_link' filter to a URL. 2015-09-15 04:15:25 +00:00
edit-form-comment.php Edit Comment screen: remove the "View Comment" button (actually a link) from the publish meta box. Mimic the "Edit URL/Permalink" UI from the Edit Post screen to show the comment link below the screen title, but make it an actual link, not a button. 2015-09-12 03:20:24 +00:00
edit-link-form.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
edit-tag-form.php Don't redirect to the Term list table after submitting the form on the Edit Term page. 2015-09-15 15:59:42 +00:00
edit-tags.php Don't redirect to the Term list table after submitting the form on the Edit Term page. 2015-09-15 15:59:42 +00:00
edit.php Remove the ability to view the post listing screen and post editing screen for post types with show_ui set to false. It is unexpected and unintended behaviour that this is allowed. 2015-09-15 10:27:29 +00:00
export.php Bump H3 headings to H2 on Export screen for better accessibility. 2015-09-05 20:09:24 +00:00
freedoms.php About: Third pass at 4.3 about page: 2015-08-13 22:11:35 +00:00
import.php Proper heading for admin screens. 2015-06-27 15:41:25 +00:00
index.php Replace some hyphens with —s in admin help tabs. 2015-08-19 04:53:25 +00:00
install-helper.php Add missing doc blocks to wp-admin/includes/*. 2015-05-29 20:17:26 +00:00
install.php Drop the hyphen from e-mail and standardize on email. 2015-08-28 03:17:21 +00:00
link-add.php
link-manager.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
link-parse-opml.php Add @global annotations for wp-admin/*. 2015-05-28 21:41:30 +00:00
link.php Fix syntax for single- and multi-line comments in wp-admin-directory files. 2014-07-17 09:14:16 +00:00
load-scripts.php Create a new file, wp-admin/includes/noop.php, which loads all of the noop functions for load-script|styles.php and is only loaded by those files. DRYs in the process. 2015-09-11 05:04:23 +00:00
load-styles.php Create a new file, wp-admin/includes/noop.php, which loads all of the noop functions for load-script|styles.php and is only loaded by those files. DRYs in the process. 2015-09-11 05:04:23 +00:00
media-new.php media-new.php, when using the browser uploader, if the result of uploading is a WP_Error - wp_die() with the error, instead of redirecting with a generic error. 2015-09-10 17:18:24 +00:00
media-upload.php Provide more helful feedback than just "Cheatin' uh?" for permission errors in wp-admin/media-upload.php. 2015-09-02 16:21:21 +00:00
media.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
menu-header.php Admin menu: improve accessibility when collapsed. 2015-06-25 19:33:26 +00:00
menu.php After [33723], ensure that $i is properly set before looping. 2015-09-02 18:48:22 +00:00
moderation.php
ms-admin.php
ms-delete-site.php Trim trailing space from string in site delete confirmation 2015-07-01 16:31:25 +00:00
ms-edit.php
ms-options.php
ms-sites.php
ms-themes.php
ms-upgrade-network.php
ms-users.php
my-sites.php Merge two similar strings about insufficient permissions. 2015-07-27 13:25:25 +00:00
nav-menus.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/nav-menus.php. 2015-09-02 18:21:21 +00:00
network.php Create wp-admin/includes/network.php via svn cp and only load it in wp-admin/network.php. Move the functions there. 2015-09-10 22:01:24 +00:00
options-discussion.php Move ad hoc Options functions to wp-admin/includes/options.php: 2015-09-10 21:45:24 +00:00
options-general.php Move ad hoc Options functions to wp-admin/includes/options.php: 2015-09-10 21:45:24 +00:00
options-head.php
options-media.php Bump H3 headings to H2 on the Media Settings screen for better accessibility. 2015-09-05 20:12:25 +00:00
options-permalink.php Move ad hoc Options functions to wp-admin/includes/options.php: 2015-09-10 21:45:24 +00:00
options-reading.php Move ad hoc Options functions to wp-admin/includes/options.php: 2015-09-10 21:45:24 +00:00
options-writing.php Bump H3 headings to H2 on the Writing Settings screen for better accessibility. 2015-09-13 16:48:26 +00:00
options.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/options.php. 2015-09-02 18:31:21 +00:00
plugin-editor.php Bump H3 headings to H2 on the Plugin Editor screen for better accessibility. 2015-09-12 00:08:24 +00:00
plugin-install.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
plugins.php Move plugin_sandbox_scrape() from wp-admin/plugins.php to wp-admin/includes/plugin.php. 2015-09-10 21:24:24 +00:00
post-new.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/post-new.php. 2015-09-02 18:36:22 +00:00
post.php Remove the ability to view the post listing screen and post editing screen for post types with show_ui set to false. It is unexpected and unintended behaviour that this is allowed. 2015-09-15 10:27:29 +00:00
press-this.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/press-this.php. 2015-09-02 18:38:21 +00:00
profile.php
revision.php Revisions screen: change language from "Return to post editor" to "Return to editor" - more generic for usage by custom post types. 2015-09-09 03:23:23 +00:00
setup-config.php foreach is a statement, not a function. 2015-08-25 20:28:22 +00:00
theme-editor.php Bump H3 headings to H2 on the Theme Editor screen for better accessibility. 2015-09-12 00:00:24 +00:00
theme-install.php Themes: Don't use HTML entities for placeholders. 2015-09-12 19:48:24 +00:00
themes.php _wpThemeSettings.l10n.searchPlaceholder is an input placeholder and doesn't handle UTF-8 or HTML entities properly. In lieu of using literal Unicode here, use .... 2015-09-10 20:36:24 +00:00
tools.php Bump H3 headings to H2 on Tools screen for better accessibility. 2015-08-31 03:32:21 +00:00
update-core.php Bump H3 headings to H2 on WordPress Updates screen for better accessibility. 2015-08-31 03:26:24 +00:00
update.php Introduce wp_validate_action( $action = '' ), a helper function that checks $_REQUEST for action and returns it, or empty string if not present. If $action is passed, it checks to make sure they match before returning it, or an empty string. Strings are always returned to avoid returning multiple types. 2015-09-11 21:08:26 +00:00
upgrade-functions.php
upgrade.php Add @global annotations for wp-admin/*. 2015-05-28 21:41:30 +00:00
upload.php Merge some similar media-related strings. 2015-07-26 23:24:24 +00:00
user-edit.php Move 2 ad hoc user admin functions: 2015-09-10 21:33:33 +00:00
user-new.php Improve validation of user_login and user_nicename length. 2015-09-15 22:14:26 +00:00
users.php When deleting via User List Table, don't prompt for re-attribution if the user(s) do(es) not have any posts. 2015-09-10 16:47:24 +00:00
widgets.php Move wp_widgets_access_body_class() (a hook callback) from wp-admin/widgets.php to wp-admin/includes/widgets.php. 2015-09-10 21:22:23 +00:00