Commit Graph

163 Commits

Author SHA1 Message Date
Drew Jaynes
1947f4d17c Docs: Apply inline @see tags to hooks referenced in DocBlocks for wp-admin/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

Built from https://develop.svn.wordpress.org/trunk@37537


git-svn-id: http://core.svn.wordpress.org/trunk@37505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 17:28:27 +00:00
Drew Jaynes
c3055cc190 Docs: Standardize hook docs in wp-admin/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37488


git-svn-id: http://core.svn.wordpress.org/trunk@37456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:01:30 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Dominik Schilling
6c81a0cbf6 Users: In edit_user() check for a blank password when adding a user.
Props wesleye, gitlost, adamsilverstein.
Fixes #35715.
Built from https://develop.svn.wordpress.org/trunk@37059


git-svn-id: http://core.svn.wordpress.org/trunk@37026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-22 23:07:27 +00:00
Boone Gorges
43d1ab4720 Use 'invalid_username' error code when tripping 'illegal_user_logins'.
This gives us better compatibility with existing errors thrown by
`sanitize_user()`, especially in Multisite, where user_login has more
restrictions on allowed characters.

Props markjaquith.
Fixes #27317.
Built from https://develop.svn.wordpress.org/trunk@35772


git-svn-id: http://core.svn.wordpress.org/trunk@35736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-04 23:25:26 +00:00
Dominik Schilling
9fb5c540bb Users: Allow to create users without sending an email to the new user.
This adds a checkbox to `wp-admin/user-new.php` to prevent sending an email with the username and a password reset link to the new user. Restores the behavior of pre-4.3.

Fixes #33504.
Props tharsheblows, SergeyBiryukov, DrewAPicture, ocean90.
Built from https://develop.svn.wordpress.org/trunk@35742


git-svn-id: http://core.svn.wordpress.org/trunk@35706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-25 22:38:29 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Sergey Biryukov
95c55ca251 Cast 'illegal_user_logins' filter result to array.
See #27317.
Built from https://develop.svn.wordpress.org/trunk@35630


git-svn-id: http://core.svn.wordpress.org/trunk@35594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-12 16:34:27 +00:00
Sergey Biryukov
b08ae1d60b Users: After [35189], make 'illegal_user_logins' check case-insensitive.
Props juliobox.
Fixes #27317.
Built from https://develop.svn.wordpress.org/trunk@35629


git-svn-id: http://core.svn.wordpress.org/trunk@35593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-12 16:30:28 +00:00
Sergey Biryukov
8aa7fb88f0 Remove a one-time variable from edit_user() added in [35189].
See #27317.
Built from https://develop.svn.wordpress.org/trunk@35190


git-svn-id: http://core.svn.wordpress.org/trunk@35156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 05:46:24 +00:00
Sergey Biryukov
7f08716c16 Users: Add 'illegal_user_logins' filter to allow certain usernames to be blacklisted.
Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov.
Fixes #27317.
Built from https://develop.svn.wordpress.org/trunk@35189


git-svn-id: http://core.svn.wordpress.org/trunk@35155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 05:43:26 +00:00
Drew Jaynes
217b661703 Docs: Add missing descriptions for the $wpdb global in DocBlocks all the places.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@35170


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Sergey Biryukov
a5c1f545c4 Users: Remove redundant error message when password is only entered once.
"Please enter the same password in both password fields" should cover all the scenarios.

Props MikeHansenMe, jmayhak, desrosj, gounder.
Fixes #33101.
Built from https://develop.svn.wordpress.org/trunk@35008


git-svn-id: http://core.svn.wordpress.org/trunk@34973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 13:22:26 +00:00
Boone Gorges
fd946a9b5a Pinking shears.
Built from https://develop.svn.wordpress.org/trunk@34534


git-svn-id: http://core.svn.wordpress.org/trunk@34498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 04:44:25 +00:00
John Blackbourn
41edf2bc22 Correctly present an error to the user if the nickname field is empty when updating a user profile. It's strange that this field is required, but it is, so be it.
Fixes #33310
Props prasad-nevase, metodiew

Built from https://develop.svn.wordpress.org/trunk@34505


git-svn-id: http://core.svn.wordpress.org/trunk@34469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 17:49:25 +00:00
Boone Gorges
85c00bd943 Move new user notification emails to add_action() callbacks.
When a new user is created in various places throughout the interface,
notifications are sent to the site admin and the new user. Previously, these
notifications were fired through direct calls to `wp_new_user_notification()`,
making it difficult to stop or modify the messages.

This changeset introduces a number of new action hooks in place of direct calls
to `wp_new_user_notification()`, and hooks the new wrapper function
`wp_send_new_user_notifications()` to these hooks.

Props dshanske, thomaswm, boonebgorges.
Fixes #33587.
Built from https://develop.svn.wordpress.org/trunk@34251


git-svn-id: http://core.svn.wordpress.org/trunk@34215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 22:19:24 +00:00
Dominik Schilling
4af3a3374e Passwords: Deprecate second parameter of wp_new_user_notification().
The second parameter `$plaintext_pass` was removed in [33023] and restored as `$notify` in [33620] with a different behavior. If you have a plugin overriding `wp_new_user_notification()` which hasn't been updated you would get a notification with your username and the password "both".
To prevent this the second parameter is now deprecated and reintroduced as the third parameter.

Adds unit tests.

Props kraftbj, adamsilverstein, welcher, ocean90.
Fixes #33654.

(Don't ask for new pluggables kthxbye)
Built from https://develop.svn.wordpress.org/trunk@34116


git-svn-id: http://core.svn.wordpress.org/trunk@34084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 12:43:26 +00:00
Boone Gorges
39fb7992a9 Require numeric IDs in user deletion functions.
`wp_delete_user()` and `wpmu_delete_user()` both require an `$id` parameter.
Previously, the functions did not verify that the value passed was, in fact,
a number. As such, passing an object or any other entity that would be cast
to int `1` would result in user 1 being deleted. We fix this by enforcing
the requirement that `$id` be numeric.

Props dipesh.kakadiya, utkarshpatel, juliobox.
Fixes #33800.
Built from https://develop.svn.wordpress.org/trunk@34034


git-svn-id: http://core.svn.wordpress.org/trunk@34002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-11 02:25:23 +00:00
Scott Taylor
a40e30e7f4 Move 2 ad hoc user admin functions:
* Move `use_ssl_preference()` from `wp-admin/user-edit.php` to `wp-admin/includes/user.php`.
* Move `admin_created_user_email()` from `wp-admin/user-new.php` to `wp-admin/includes/user.php`.

See #33813.

Built from https://develop.svn.wordpress.org/trunk@34021


git-svn-id: http://core.svn.wordpress.org/trunk@33990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 21:33:33 +00:00
Scott Taylor
49b8ccec79 When deleting via User List Table, don't prompt for re-attribution if the user(s) do(es) not have any posts.
Props rajnikmit, wojtek.szkutnik, benjmay, wonderboymusic.
Fixes #6405. 

Built from https://develop.svn.wordpress.org/trunk@34000


git-svn-id: http://core.svn.wordpress.org/trunk@33969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 16:47:24 +00:00
Helen Hou-Sandí
1f500055a6 Drop the hyphen from e-mail and standardize on email.
The AP Stylebook changed this in 2011, and we're woefully inconsistent, so let's go with the standard.

props morganestes, voldemortensen, niallkennedy (for patching on the previous AP style).
fixes #26156.

Built from https://develop.svn.wordpress.org/trunk@33774


git-svn-id: http://core.svn.wordpress.org/trunk@33742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 03:17:21 +00:00
John Blackbourn
a60d143f7b Correct the hook docs for the user_profile_update_errors action.
Fixes #33537
Props yamchhetri

Built from https://develop.svn.wordpress.org/trunk@33769


git-svn-id: http://core.svn.wordpress.org/trunk@33737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-27 17:16:21 +00:00
Konstantin Obenland
e6bc6242ad Passwords: Restore second parameter for wp_new_user_notification().
After [33023] users would always be notified, this restores previous behavior.

Props markjaquith, ocean90.
Fixes #33358.


Built from https://develop.svn.wordpress.org/trunk@33620


git-svn-id: http://core.svn.wordpress.org/trunk@33587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-17 14:25:27 +00:00
Dion Hulse
aace7c2c8d Function documentation: Fix a broken docbock introduced with [32642].
See #32444.

Built from https://develop.svn.wordpress.org/trunk@33601


git-svn-id: http://core.svn.wordpress.org/trunk@33568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-10 10:50:26 +00:00
Mark Jaquith
c5719ba15a Make the "using default password" nag more accurate.
"Easy to remember" isn't necessarily what we want to encourage.

fixes #33168
props arjunskumar
Built from https://develop.svn.wordpress.org/trunk@33485


git-svn-id: http://core.svn.wordpress.org/trunk@33452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 14:06:25 +00:00
Mark Jaquith
423a1a7ca4 New password change/set UI.
* Generate the password for the user
* More tightly integrate password strength meter
* Warn on weak passwords

see #32589

props MikeHansenMe, adamsilverstein, binarykitten
Built from https://develop.svn.wordpress.org/trunk@33023


git-svn-id: http://core.svn.wordpress.org/trunk@32994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 14:48:24 +00:00
Scott Taylor
c6a4512b1b Add missing doc blocks to wp-admin/includes/*.
Fix some egregious uses of tabbing.
Some functions can simply return `apply_filters(...)` instead of setting a variable that is immediately returned.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32654


git-svn-id: http://core.svn.wordpress.org/trunk@32624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 20:17:26 +00:00
Scott Taylor
a51dfa3971 In the style of #30947 and default-filters.php, add 2 new files to wp-admin/includes:
`admin-filters.php`
`ms-admin-filters.php`

There are random actions and filters littered among files like `misc.php`. These files contain functions that won't work outside of admin context and are typically only loaded in files that have already loaded the admin bootstrap.

See #32529.

Built from https://develop.svn.wordpress.org/trunk@32653


git-svn-id: http://core.svn.wordpress.org/trunk@32623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 17:04:26 +00:00
Scott Taylor
b56b9b3e5c Add @global annotations for wp-admin/*.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32642


git-svn-id: http://core.svn.wordpress.org/trunk@32612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 21:41:30 +00:00
Drew Jaynes
ba1e7a7243 Correct grammar when referring to "a user" vs "an user" in several places.
Props ocean90.
Fixes #31894.

Built from https://develop.svn.wordpress.org/trunk@32025


git-svn-id: http://core.svn.wordpress.org/trunk@32004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 14:44:27 +00:00
Scott Taylor
7d7a8aa0eb Correct all @return unknown instances.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30202


git-svn-id: http://core.svn.wordpress.org/trunk@30202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 06:17:22 +00:00
Boone Gorges
24babfddb3 Allow apostrophes in email addresses when adding users via the Dashboard.
Email addresses entered in a number of interfaces were not being stripslashed
properly, with the result that the emails were not being recognized as valid.

Fixes #18039.
Built from https://develop.svn.wordpress.org/trunk@29966


git-svn-id: http://core.svn.wordpress.org/trunk@29713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-19 20:30:19 +00:00
Drew Jaynes
097dc8ee15 Fix syntax for single- and multi-line comments in wp-admin-directory files.
See #28931.

Built from https://develop.svn.wordpress.org/trunk@29206


git-svn-id: http://core.svn.wordpress.org/trunk@28990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 09:14:16 +00:00
Scott Taylor
2f513d3320 Fix some hackificator odds and ends in wp-admin:
* `wp-activate.php` and `wp-admin/themes.php` don't need the closing PHP tag
* Switch single quotes for HTML attribute values to double in a few places
* Convert `include_once file.php` syntax to `include_once( 'file.php' )`
* Add access modifiers to methods/members in: `_WP_List_Table_Compat`, `Walker_Nav_Menu_Edit`, `Walker_Nav_Menu_Checklist`, `WP_Screen`, `Walker_Category_Checklist`
* `edit_user()` doesn't need to import the `$wpdb` global
* `wp_list_widgets()` doesn't need to import the `$sidebars_widgets` global
* switch/endswitch syntax is not supported in Hack
* A `<ul>` in `wp-admin/users.php` is unclosed

See #27881.

Built from https://develop.svn.wordpress.org/trunk@28500


git-svn-id: http://core.svn.wordpress.org/trunk@28326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:04:16 +00:00
Andrew Nacin
edfe443afc Remove lame debugging. see #23057.
Built from https://develop.svn.wordpress.org/trunk@27467


git-svn-id: http://core.svn.wordpress.org/trunk@27312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 03:16:27 +00:00
Andrew Nacin
60953e88fd Normalize $reassign in wp_delete_user() to ensure the hooks receive consistent values.
fixes #23057.

Built from https://develop.svn.wordpress.org/trunk@27466


git-svn-id: http://core.svn.wordpress.org/trunk@27311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 03:16:14 +00:00
Sergey Biryukov
0a0589414e Fix docblock formatting in [27462]. see #23057.
Built from https://develop.svn.wordpress.org/trunk@27463


git-svn-id: http://core.svn.wordpress.org/trunk@27308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 01:26:13 +00:00
Sergey Biryukov
9c6504120f Pass $reassign parameter to 'delete_user' and 'deleted_user' actions.
props genkisan.
fixes #23057.
Built from https://develop.svn.wordpress.org/trunk@27462


git-svn-id: http://core.svn.wordpress.org/trunk@27307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 01:23:15 +00:00
Andrew Nacin
c102fd5a9d Make the user arguments for get_edit_profile_url() and get_dashboard_url() optional, defaulting to the current user.
props garyc40.
fixes #16686.

Built from https://develop.svn.wordpress.org/trunk@27260


git-svn-id: http://core.svn.wordpress.org/trunk@27117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:08:13 +00:00
Drew Jaynes
cd8cedc40d First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.

Built from https://develop.svn.wordpress.org/trunk@26868


git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Drew Jaynes
c9077348ee Inline documentation for hooks in wp-admin/includes/user.php.
Props aaronholbrook for the initial patch.
Fixes #26099.

Built from https://develop.svn.wordpress.org/trunk@26503


git-svn-id: http://core.svn.wordpress.org/trunk@26397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-01 17:54:10 +00:00
Andrew Nacin
00c545606e Introduce wp_get_user_contact_methods() as a public version of _wp_get_user_contactmethods.
props johnnyb.
fixes #24273.

Built from https://develop.svn.wordpress.org/trunk@25606


git-svn-id: http://core.svn.wordpress.org/trunk@25523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 18:14:09 +00:00
Sergey Biryukov
6760d294bb Update phpdoc for get_user_to_edit(), get_userdata(), and get_user_by(). props tivnet. fixes #24992.
Built from https://develop.svn.wordpress.org/trunk@25204


git-svn-id: http://core.svn.wordpress.org/trunk@25176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-02 03:25:09 +00:00
Sergey Biryukov
34d0f347ad Revert to storing a hash of the slashed password. fixes #24367. see #17018.
git-svn-id: http://core.svn.wordpress.org/trunk@24508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-25 11:14:50 +00:00
Andrew Nacin
17ddaa8de0 delete_user_setting() and remove_action() were getting called with too many args. props rlerdorf. see #24210.
git-svn-id: http://core.svn.wordpress.org/trunk@24125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 13:25:15 +00:00
Sergey Biryukov
831afad92c When adding a new user in the admin, strip slashes from the password sent to the user by email. props hakre for initial patch. fixes #17018.
git-svn-id: http://core.svn.wordpress.org/trunk@23634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-07 06:00:16 +00:00
Ryan Boren
f3a83744e9 Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
git-svn-id: http://core.svn.wordpress.org/trunk@23567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 17:14:09 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Ryan Boren
cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Andrew Nacin
55ba72f46e Confirm a user exists before deleting them in wp_delete_user() and wpmu_delete_user(). props scribu, fixes #23067.
git-svn-id: http://core.svn.wordpress.org/trunk@23380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-02 04:41:02 +00:00