Commit Graph

393 Commits

Author SHA1 Message Date
Pascal Birchler 9612c26db3 Users: Introduce `_wp_get_current_user()` for improved backward compatibility.
This new helper function is used by the pluggable functions `wp_get_current_user()` and `get_currentuserinfo()`, which was previously being called by the former before [36311]. Without it, infinite loops could be caused when plugins implement these functions, as they are now called the other way around.

Fixes #19615.
Built from https://develop.svn.wordpress.org/trunk@36651


git-svn-id: http://core.svn.wordpress.org/trunk@36618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 22:26:28 +00:00
Dominik Schilling 7ebe2c1e7a Authentication: Allow users to log in using their email address.
Introduces `wp_authenticate_email_password()` which is hooked into `authenticate` after `wp_authenticate_username_password()`.

Props Denis-de-Bernardy, ericlewis, vhomenko, MikeHansenMe, swissspidy, ocean90.
Fixes #9568.
Built from https://develop.svn.wordpress.org/trunk@36617


git-svn-id: http://core.svn.wordpress.org/trunk@36584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-22 23:15:27 +00:00
Drew Jaynes 12bdf5a6da Docs: Improove the DocBlock summary for `wp_signon()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 08:11:25 +00:00
Boone Gorges 20c07afbd5 When updating a user, invalidate its 'userslugs' cache.
`user_nicename` can be changed via `wp_update_user()`, so we invalidate just
to be safe.

Props thebrandonallen.
Fixes #35750.
Built from https://develop.svn.wordpress.org/trunk@36482


git-svn-id: http://core.svn.wordpress.org/trunk@36449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-05 19:03:26 +00:00
Pascal Birchler b9fd40a8cb Users: Decode special characters in password and email change notification emails.
Fixes #35283.
Built from https://develop.svn.wordpress.org/trunk@36306


git-svn-id: http://core.svn.wordpress.org/trunk@36273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 07:29:27 +00:00
Eric Lewis c52af7470b Login is not a verb, change "login" to "log in".
See #35387

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


git-svn-id: http://core.svn.wordpress.org/trunk@36213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 21:08:26 +00:00
Eric Lewis 2f41867519 Users: Fix incorrect docs for user authentication and login functions.
Fixes #35387

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


git-svn-id: http://core.svn.wordpress.org/trunk@36212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 20:52:27 +00:00
Sergey Biryukov 8009f97f79 Docs: Correct `@return` type for `count_user_posts()`.
Props nofearinc.
Fixes #35222.
Built from https://develop.svn.wordpress.org/trunk@36085


git-svn-id: http://core.svn.wordpress.org/trunk@36050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-25 20:18:27 +00:00
Gary Pendergast f9bba421b5 User: Don't continue checking a password reset key, if the hash is empty.
An empty reset key hash will never be valid, so we can skip seeing if it can be used to validate the given key, and return a failure early.

This fixes a warning in the unit tests under HHVM.

See #33926.



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


git-svn-id: http://core.svn.wordpress.org/trunk@36049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-24 02:49:26 +00:00
Drew Jaynes 28412d2ef2 Docs: Add missing parameter and return descriptions to the DocBlock for `_wp_get_user_contactmethods()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 16:41:27 +00:00
John Blackbourn 26dfc6159f Correct a parameter name for the `allow_password_reset` filter so its entry on developer.wordpress.org displays correctly.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@35934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 19:20:26 +00:00
Gary Pendergast 31f51e2cbb The the Docs: Fix the the dittography
Sometimes, it's easy to to type the the same word twice, especially if if it's a simple word. We probably shouldn't do do do (do do do doo) it, though.

(I've excluded external libs from this change.)

Fixes #34885.


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


git-svn-id: http://core.svn.wordpress.org/trunk@35757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:23:25 +00:00
Boone Gorges 714be37ea5 Show user_login in Dashboard user dropdowns.
User dropdowns in wp-admin have traditionally shown the users' display names.
However, this causes ambiguity when users share display names. To correct this,
we now show the unique user_login in parentheses after the display name.

The new `display_name_with_login` value for the `show` parameter of
`wp_dropdown_users()` enables this functionality. The default value of `show`
has not been changed, for backward compatibility, but all instances of
`wp_dropdown_users()` in core wp-admin have been switched.

This changeset also reduces some duplicated logic when assembling a user list
when `include_selected` is true.

Props krogsgard, boonebgorges.
Fixes #31251.
Built from https://develop.svn.wordpress.org/trunk@35790


git-svn-id: http://core.svn.wordpress.org/trunk@35754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 20:57:26 +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 7250749032 Reset Password: Add a missing `new` operator for `WP_Error` in `get_password_reset_key()`.
Missed in [34923].

Fixes #34180.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-04 15:31: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
Andrew Nacin 1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
Drew Jaynes 51b778fb03 Docs: The User API is singular.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:03:24 +00:00
Drew Jaynes 5cf6c74499 Docs: Clarify the file header summary for wp-includes/user.php, the top-level file for the core Users API.
Also adds inline DocBlocks for the `require_once()` calls that now bring in core users functionality and the `WP_User_Query` class, as of [33749].

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-04 01:33:24 +00:00
Scott Taylor 484331e492 Users: move `WP_User_Query` into its own file. `user.php` loads the new files, so this is 100% BC if someone is loading `user.php` directly (a lot of plugins do). New files created using `svn cp`.
Creates: 
`class-wp-user-query.php` 
`user-functions.php` 

`user.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 04:20:21 +00:00
Drew Jaynes dbdc8bf149 Docs: Clarify the return description for `wp_create_user()` to illustrate that a `WP_Error` object will be returned on failure.
Props jmayhak
Fixes #33321.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-24 22:23:24 +00:00
Drew Jaynes 5e32a0c646 Docs: Better clarify that the `$post_type` parameter for the `get_usernumposts` filter and `count_user_posts()` can accept either a single post type or array of post types.
Props tyxla
See #33481. Fixes #33520.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-23 17:46:24 +00:00
Boone Gorges 6ab7493b27 Pass the `$public_only` value to 'get_usernumposts' filter.
[32523] introduced the `$public_only` parameter to `count_user_posts()`. That
changeset was supposed to pass `$public_only` to the 'get_usernumposts' filter
at the end of the function, but only the documentation was modified, not the
filter itself.

This changeset also fixes an incorrect variable name in the docblock for
the same filter.

Props swisspidy, tmatsuur.
Fixes #33481 for trunk.
Built from https://develop.svn.wordpress.org/trunk@33710


git-svn-id: http://core.svn.wordpress.org/trunk@33677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-22 18:59:26 +00:00
Scott Taylor c192d90fa1 In `wp_insert_user()`, add a filter: `insert_user_meta`, to filter a user's meta values and keys before the user is created or updated.
Props tharsheblows, chriscct7, DrewAPicture.
Fixes #31549.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-22 17:12:25 +00:00
Drew Jaynes 0e4285c451 Docs: Fix a typo in the DocBlock description for `_get_additional_user_keys()`, introduced in [33687].
Props dimadin
See #29120.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 16:01:28 +00:00
Drew Jaynes 6d405d34da Docs: Clarify the DocBlock summary and add a description and return description for `_get_additional_user_keys()`.
As noted in the description, returned keys being set is dependent on the existence of those keys in user meta at the point where `_get_additional_user_keys()` is called in `wp_update_user()`.

Fixes #29120.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 05:33:25 +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
Mark Jaquith 97280576c0 Change send_pass_change_email to send_password_change_email (better name).
see #32430
Built from https://develop.svn.wordpress.org/trunk@33486


git-svn-id: http://core.svn.wordpress.org/trunk@33453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 14:52:26 +00:00
Drew Jaynes a929b8efe5 Fix the same typo again in the hook doc summary for the `send_pass_change_email` filter.
I speak English, I do.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:27:24 +00:00
Drew Jaynes 9de2f22655 Fix a typo in the hook docs summary for the `send_pass_change_email` filter.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:25:24 +00:00
Drew Jaynes 8ef2cd1537 Fix the inline documentation syntax in the hook docs for the `email_change_email` filter, introduced in 4.3.
Also update the filter summary to reflect that the file is for an "email" change, not a "password" change.

See [32820]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:15:24 +00:00
Drew Jaynes 86f21b4d90 Fix the inline documentation syntax in the hook docs for the `password_change_email` filter, introduced in 4.3.
See [32820]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:11:24 +00:00
Drew Jaynes 284b726bfb Fix the inline documentation syntax in the hook docs for the `send_email_change_email` filter, added in 4.3.
See [32820]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:08:24 +00:00
Drew Jaynes 96ed7056cd Fix the inline documentation syntax in the hook docs for the `send_pass_change_email` filter, added in 4.3.
See [32820]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:05:25 +00:00
Drew Jaynes 668bdf60fb Wrap a long changelog entry description in the DocBlock for `count_user_posts()`.
Also clarify the description for the new `$public_only` parameter, added in [32523].

See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 22:03:24 +00:00
Scott Taylor 6c90a44828 After [32980], update the docs to reflect that `display_name` is now included when searching for users in some scenarios.
Fixes #27304.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-07 19:39:25 +00:00
Scott Taylor 6b034b67f5 In `wp_insert_user()`, comparing an email address against the user's old email address should not be case-sensitive.
Adds unit tests.

Props tyxla.
Fixes #32158.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-07 19:29:24 +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
Dion Hulse c261ad2c57 Expire password reset links after 24 hours (by default). This causes existing password reset links to become invalid.
Props markjaquith, voldemortensen, johnbillion, MikeHansenMe, dd32
See #32429

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


git-svn-id: http://core.svn.wordpress.org/trunk@32990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 06:33:26 +00:00
Scott Taylor 5b9b3cedea When searching for users using the `search` arg in `get_users()`/`WP_User_Query`, also search the user's email, url, and display name.
Adds unit tests.

Props mordauk, wonderboymusic.
Fixes #27304.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-28 00:36:24 +00:00
Scott Taylor d6c644d8df After [32884], update the default value for `comment_shortcuts`.
Props dlh, rachelbaker, DrewAPicture.
Fixes #31588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-22 20:44:26 +00:00
Dominik Schilling 4423739c65 Use 3-digit x.x.x style for `4.3.0` @since versions.
see #32335, #32430.
Built from https://develop.svn.wordpress.org/trunk@32897


git-svn-id: http://core.svn.wordpress.org/trunk@32868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-21 11:41:26 +00:00
Drew Jaynes 1077b83a20 Update the DocBlock for `wp_insert_post()` to exclude now-defunct contact method arguments and clarify others.
Also clarifies information on available hooks and adds a changelog entry for when the contact method arguments were removed.

Props dlh, rachelbaker.
See #31588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 02:53:27 +00:00
Scott Taylor 5e994cd6a1 Customizer et al, use `elseif` in PHP, not `else if`.
This was corrected via brute force in [31090].

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:01:25 +00:00
Boone Gorges 2e5e0bdc78 When updating a user, only send email-change notification if email address is passed.
The notification, introduced in [32380], was firing incorrectly (and throwing
a PHP notice) when `wp_update_user()` was called without including 'user_email'
in the update data.

Props imath.
Fixes #32684. See #32430.
Built from https://develop.svn.wordpress.org/trunk@32838


git-svn-id: http://core.svn.wordpress.org/trunk@32809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-18 13:30:26 +00:00
Mark Jaquith 814865ea9e Send emails when a user's email address or password is changed.
* In case of email change, email goes to the OLD address
* Prevents against issues where an account is compromised (say via cookie interception) and then the attacker silently takes over ownership via pw/email changes — now there will at least be a record that something is up

fixes #32430
props RMarks, MikeHansenMe, tharsheblows, obenland
Built from https://develop.svn.wordpress.org/trunk@32820


git-svn-id: http://core.svn.wordpress.org/trunk@32791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-17 19:31:27 +00:00
Boone Gorges 5dfd6a02a7 Avoid returning duplicate matches when using a meta query in `WP_User_Query`.
A meta_query containing an `OR` relation can result in the same record matching
multiple clauses, leading to duplicate results. The previous prevention against
duplicates [18178] #17582 became unreliable in 4.1 when `WP_Meta_Query`
introduced support for nested clauses. The current changeset adds a new method
`WP_Meta_Query::has_or_relation()` for checking whether an `OR` relation
appears anywhere in the query, and uses the new method in `WP_User_Query` to
enforce distinct results as necessary.

Props maxxsnake.
Fixes #32592.
Built from https://develop.svn.wordpress.org/trunk@32713


git-svn-id: http://core.svn.wordpress.org/trunk@32683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-09 17:42:28 +00:00
Sergey Biryukov 50369e1c98 Add `@since` for `check_password_reset_key()`, `reset_password()`, and `register_new_user()`.
see #20279.
Built from https://develop.svn.wordpress.org/trunk@32696


git-svn-id: http://core.svn.wordpress.org/trunk@32666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-05 20:39:26 +00:00
Boone Gorges 2c9a2850b4 Add `@since` entry for 'has_published_post' argument of `WP_User_Query`.
Mega-props DrewAPicture.
Fixes #32250.
Built from https://develop.svn.wordpress.org/trunk@32685


git-svn-id: http://core.svn.wordpress.org/trunk@32655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-02 18:21:26 +00:00