Prior to this change, the nonce passed from `wp-signup.php` was verified with a simple comparison. Furthermore in case of failures, `wp_die()` would be called right during the HTML markup being already printed. Now the error message is returned properly, modifying the `WP_Error` object in the passed `$result`.
Props herregroen.
Fixes#43667.
Built from https://develop.svn.wordpress.org/trunk@42976
git-svn-id: http://core.svn.wordpress.org/trunk@42805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`get_sites()` queries for a maximum of 100 records by default. In `domain_exists()`, we only use one.
A previous commit, [41736], has this same commit message but applies to `get_blog_id_from_url()` and #42073 instead.
Props danieltj, spacedmonkey.
Fixes#42072.
Built from https://develop.svn.wordpress.org/trunk@41738
git-svn-id: http://core.svn.wordpress.org/trunk@41572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`is_user_option_local()` was added during MU development and used for a handful of changesets before the code using it was removed again. It has not been used by MU or core since nor is it widely used elsewhere.
Fixes#41697.
Props bnap00, jeremyfelt.
Built from https://develop.svn.wordpress.org/trunk@41668
git-svn-id: http://core.svn.wordpress.org/trunk@41502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`get_current_blog_id()` is more appropriate for determining the ID of the current site in most cases. This eliminates the need for the global `$wpdb` in several functions and is better than the implicit global used in admin pages.
Props bnap00, spacedmonkey.
Fixes#41684.
Built from https://develop.svn.wordpress.org/trunk@41661
git-svn-id: http://core.svn.wordpress.org/trunk@41495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Calling the `count_users()` function is expensive, regardless of the counting strategy that's used, and it gets
slower the more users there are on a site. In order to speed up the Users screen in the admin area, calling
`count_users()` can be avoided entirely while still displaying the total count for users.
This introduces some new functions:
* `wp_is_large_user_count()`
* `wp_get_active_user_count()`
* `wp_update_active_user_count()`
A corresponding `wp_is_large_user_count` filter is also introduced.
Props tharsheblows, johnbillion
Fixes#38741
Built from https://develop.svn.wordpress.org/trunk@41613
git-svn-id: http://core.svn.wordpress.org/trunk@41448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This was accidentally introduced in [41125]. Since the `added_existing_user` filter has historically accepted either `true` or a `WP_Error` object, the clause is not necessary here. The doc block has been adjusted to account for the new possible `WP_Error` condition.
Fixes#41101.
Built from https://develop.svn.wordpress.org/trunk@41324
git-svn-id: http://core.svn.wordpress.org/trunk@41155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
"Install" is not a noun, and while it might be acceptable to use the verb as a noun, it is not correct. Using the correct
noun, "installation", increases clarity, especially for non-native English speakers.
This change fixes the usage in user-facing text and in developer documentation.
Fixes#41620
Built from https://develop.svn.wordpress.org/trunk@41289
git-svn-id: http://core.svn.wordpress.org/trunk@41129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Under certain circumstances, it can be necessary that a user should not be added to a site, beyond the restrictions that WordPress core applies. With the new `can_add_user_to_blog` filter, plugin developers can run custom checks and return an error in case of a failure, that will prevent the user from being added.
The user-facing parts and the REST API route that interact with `add_user_to_blog()` have been adjusted accordingly to provide appropriate error feedback when a user could not be added to a site. Furthermore, two existing error feedback messages in the site admin's "New User" screen have been adjusted to properly show inside an error notice instead of a success notice.
Props jmdodd.
Fixes#41101.
Built from https://develop.svn.wordpress.org/trunk@41225
git-svn-id: http://core.svn.wordpress.org/trunk@41065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This reduces the chances of a site compromise going unnoticed, in the same way that the same notifications for user account email address changes reduces the chances of a user account compromise going unnoticed.
Props MatheusGimenez, johnbillion
Fixes#39117
Built from https://develop.svn.wordpress.org/trunk@41164
git-svn-id: http://core.svn.wordpress.org/trunk@41004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Before this changeset, the language of a new site would always result in the language of the current network, regardless of the `$site_id` parameter passed that actually determines the network for the site. Now the correct `WPLANG` value is used in such cases.
Alongside this change, a few minor documentation changes around the function have been made to account for the current naming conventions of sites and networks.
Props spacedmonkey.
Fixes#40503.
Built from https://develop.svn.wordpress.org/trunk@41058
git-svn-id: http://core.svn.wordpress.org/trunk@40908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prior to this change, after creating a site, the network site count was always refreshed on the current network, regardless of whether the site was created on a different network. With the recent changes, particularly [40591], it is now possible to update the site count for a specific `$network_id`, so this changeset makes use of the new parameter.
Fixes#38699.
Built from https://develop.svn.wordpress.org/trunk@40612
git-svn-id: http://core.svn.wordpress.org/trunk@40482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If an email address is missing an `@`, we can't assume enough to check it against a list of domain names.
Additional validation of email should happen in `is_email()` before being passed to `is_email_address_unsafe()`.
Fixes#39915.
Built from https://develop.svn.wordpress.org/trunk@40595
git-svn-id: http://core.svn.wordpress.org/trunk@40465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Now that `get_blog_count()` and `get_user_count()` both support passing a `$network_id` parameter (see [40370] and [40371]), similar functionality is now available for `wp_is_large_network()`. In addition, the filter `wp_is_large_network` now accepts the network ID as its fourth parameter.
This changeset furthermore introduces unit tests for the `wp_is_large_network()` function and its filter.
Fixes#40489.
Built from https://develop.svn.wordpress.org/trunk@40590
git-svn-id: http://core.svn.wordpress.org/trunk@40460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prior to this change, the minimum site name length checked in `wpmu_validate_blog_signup()` was set to a fixed value of 4. The new filter allows tweaking this value, as there may be cases where shorter site names may be required.
Fixes#39676.
Built from https://develop.svn.wordpress.org/trunk@40589
git-svn-id: http://core.svn.wordpress.org/trunk@40459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using the new parameter, it is now possible to update the user count on a network different from the current one. While the count itself is technically a global user count and not network-wide, it is stored on each individual network, and the new parameter provides more control about where to update the count.
Fixes#40349. See #38699.
Built from https://develop.svn.wordpress.org/trunk@40485
git-svn-id: http://core.svn.wordpress.org/trunk@40361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[40295] removed the restriction of a minimum amount of characters for new site names, which could cause unexpected behavior. That changeset is reverted here with the exception of the removal of the `is_super_admin()` check, which can safely be omitted. A new filter for the minimum site name length will be introduced later to be able to modify that behavior.
See #39676, #37616.
Built from https://develop.svn.wordpress.org/trunk@40391
git-svn-id: http://core.svn.wordpress.org/trunk@40298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `get_user_count()` function returns the number of active users on a network, which is stored in a `user_count` network option. Since `get_network_option()` supports retrieving options from other networks than the current one, `get_user_count()` can now make use of that feature.
Fixes#37866.
Built from https://develop.svn.wordpress.org/trunk@40371
git-svn-id: http://core.svn.wordpress.org/trunk@40278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `get_blog_count()` function used to support an `$id` parameter for the network ID prior to WordPress 3.1. This parameter has not been used since the introduction of `get_site_option()` and was later deprecated in [25113]. With `get_network_option()` however it is possible to support the parameter again, now properly renamed as `$network_id`.
A unit test has for the parameter has been added as well. Another unit test in the same class was adjusted to work properly with multiple networks existing.
Fixes#37865.
Built from https://develop.svn.wordpress.org/trunk@40370
git-svn-id: http://core.svn.wordpress.org/trunk@40277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
It is sometimes desirable to support shorter site names than 4 characters, therefore that restriction should be removed. It is still possible to manually enforce it by using the `wpmu_validate_blog_signup` filter.
As a result of this change, another `is_super_admin()` call gets removed which affects the ongoing efforts of working on a network-wide role system.
Props milindmore22.
Fixes#39676. See #37616.
Built from https://develop.svn.wordpress.org/trunk@40295
git-svn-id: http://core.svn.wordpress.org/trunk@40202 1a063a9b-81f0-0310-95a4-ce76da25c4cd