Commit Graph

438 Commits

Author SHA1 Message Date
Felix Arntz 85712eb281 Multisite: Fix documentation issues for `domain_exists()`.
Props stevenlinx.
Fixes #41619.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-26 00:12:45 +00:00
John Blackbourn 9aeedde6ae Multisite: Correct the docs for `maybe_add_existing_user_to_blog()`.
See #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 12:28:44 +00:00
Felix Arntz 70daaadc6a Multisite: Remove an unnecessary if clause wrapping the `added_existing_user` filter.
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
2017-08-30 19:53:45 +00:00
John Blackbourn 28eda6f4bc General: Improve terminology used when referring to installations of WordPress and its extensions.
"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
2017-08-22 11:52:48 +00:00
Felix Arntz 473e1ba73b Multisite: Remove references to `$wpdb->siteid` and use `get_current_network_id()` instead.
Props sathyapulse, spacedmonkey.
Fixes #41507.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-12 13:11:43 +00:00
Felix Arntz 820d3973a3 Multisite: Rename internal `$site_id` variables referencing networks to `$network_id`.
This change improves code clarity by using the current naming conventions for networks.

Props lemacarl.
Fixes #41510.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-12 12:48:47 +00:00
John Blackbourn c26b735c8a Multisite: Clarify descriptions of the `wpmu_signup_blog_notification()` and `wpmu_signup_user_notification()` functions.
See #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-04 14:21:43 +00:00
Felix Arntz 7e2ca92e69 Multisite: Introduce a `can_add_user_to_blog` filter to prevent adding a user to a site.
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
2017-08-03 21:41:45 +00:00
Drew Jaynes 0401cee8b3 Docs: Reduce confusion in `@since MU` notationss by indicating the WP version (3.0.0) the code was merged into core while retaining the original context.
Props sathyapulse.
Fixes #41509.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-01 20:44:43 +00:00
John Blackbourn b9b4776800 Options, Meta APIs: Send a notification to the old admin email address when the site admin email or network admin email address is changed.
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
2017-07-27 02:24:42 +00:00
Felix Arntz df8506f523 Multisite: Use `get_network_option()` for language in `wpmu_create_blog()`.
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
2017-07-14 21:08:43 +00:00
Drew Jaynes faab7f4533 Docs: Improve and clarify the DocBlock summary for `wpmu_log_new_registrations()`.
Props daymobrew.
Fixes #39922.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-26 18:05:41 +00:00
Drew Jaynes fafa1dfa07 Docs: Add more complete documentation about expected values in the `$meta` parameter for `wpmu_create_blog()`.
See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 05:48:45 +00:00
Felix Arntz 0f4725a0e3 Multisite: Adjust site count of the correct network after having created a new site.
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
2017-05-10 23:22:42 +00:00
Jeremy Felt 5b3d397133 Multisite: Check only valid looking emails against banned domain list.
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
2017-05-09 16:55:40 +00:00
Jeremy Felt 3600dc562e Multisite: Validate email before checking against banned domains.
Previously, an invalid email could result in an undefined index when attempting to determine the email domain.

Props ocean90.
See #39915.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-09 16:33:46 +00:00
Felix Arntz d92dbd24fc Multisite: Add `$network_id` parameter to `wp_maybe_update_network_user_counts()`.
This allows calling the function for a specific network correctly, for example after a user has been created for it or been removed from it.

Fixes #40385. See #38699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-09 16:08:43 +00:00
Felix Arntz 314f2aecec Multisite: Add missing documentation for new `$network_id` parameter of `wp_maybe_update_network_site_counts()`.
This was overlooked in [40591].

See #40384.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-09 16:02:46 +00:00
Felix Arntz 93b8b9bb4e Multisite: Add `$network_id` parameter to `wp_maybe_update_network_site_counts()`.
This allows calling the function for a specific network correctly, for example after a site has been created for it or been removed from it.

Fixes #40384. See #38699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-09 16:00:44 +00:00
Felix Arntz 039d49a68a Multisite: Add `$network_id` parameter to `wp_is_large_network()`.
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
2017-05-09 15:51:47 +00:00
Felix Arntz a3797875bf Multisite: Introduce `minimum_site_name_length` filter.
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
2017-05-09 14:59:47 +00:00
Felix Arntz 9c8bf59842 Multisite: Add `$network_id` parameter to `wp_update_network_counts()`.
After the `$network_id` parameter has been introduced for `wp_update_network_site_counts()` in [40484] and `wp_update_network_user_counts()` in [40485], the new parameter can now also be used on the wrapping function.

Fixes #40386. See #38699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-20 00:27:42 +00:00
Felix Arntz 79be8dff6d Multisite: Add `$network_id` parameter to `wp_update_network_user_counts()`.
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
2017-04-20 00:14:43 +00:00
Felix Arntz 7fa610b34a Multisite: Add `$network_id` parameter to `wp_update_network_site_counts()`.
Using the new parameter, it is now possible to update the site counts on a network different from the current network.

Props PieWP, johnjamesjacoby.
Fixes #37528. See #38699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-20 00:00:42 +00:00
Felix Arntz ce6153d52a Multisite: Partially revert [40295].
[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
2017-04-07 13:15:42 +00:00
Felix Arntz 58b810e9eb Multisite: Add `$network_id` parameter to `get_user_count()`.
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
2017-04-05 02:18:00 +00:00
Felix Arntz 924e31583c Multisite: Support the `$network_id` parameter of `get_blog_count()`.
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
2017-04-05 02:17:18 +00:00
Felix Arntz 2295ed8031 Multisite: Remove restriction of minimum site name length in `wpmu_validate_blog_signup()`.
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
2017-03-17 14:36:43 +00:00
Sergey Biryukov 3c1ce66767 Users: Introduce `signup_site_meta` and `signup_user_meta` for filtering signup metadata in `wpmu_signup_blog()` and `wpmu_signup_user()`, respectively.
Props Mista-Flo.
Fixes #39223.
Built from https://develop.svn.wordpress.org/trunk@39920


git-svn-id: http://core.svn.wordpress.org/trunk@39857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-17 03:53:42 +00:00
Sergey Biryukov 351a3b6d69 Docs: Make `$meta` parameter description in multisite signup and registration functions more consistent.
See #38781.
Built from https://develop.svn.wordpress.org/trunk@39887


git-svn-id: http://core.svn.wordpress.org/trunk@39824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-12 05:21:41 +00:00
Sergey Biryukov 3f59be8c97 Users: In `wpmu_signup_blog()` and `wpmu_signup_user()`, pass unserialized signup meta data to `after_signup_site` and `after_signup_user` filters introduced in [34112], to match the documented value.
Props MaximeCulea.
Fixes #38781.
Built from https://develop.svn.wordpress.org/trunk@39886


git-svn-id: http://core.svn.wordpress.org/trunk@39823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-12 04:57:39 +00:00
Jeremy Felt cea9e2dc62 Multisite: Use `wp_rand()` in signup key creation.
Built from https://develop.svn.wordpress.org/trunk@39795


git-svn-id: http://core.svn.wordpress.org/trunk@39733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-11 05:30:42 +00:00
John Blackbourn 80a839de13 Docs: Misc corrections and additions to inline documentation.
See #39130
Props keesiemeijer

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


git-svn-id: http://core.svn.wordpress.org/trunk@39579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:28:40 +00:00
John Blackbourn d327c92e4b Docs: Add and correct `@since` docs for a variety of functions and methods.
Props keesiemeijer, chris_dev
Fixes #39343, #39357, #39344
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:21:44 +00:00
John Blackbourn 4cf5550d8d I18n: Begin introducing translator comments for strings which include placeholders but no accompanying translator comment.
Adds context to one string used in two different contexts for the new user and new site signup email notification.

More to come.

See #38882

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


git-svn-id: http://core.svn.wordpress.org/trunk@39263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 01:22:32 +00:00
Dominik Schilling 788761c601 Multisite: Rename the `$user` parameter to `$user_login` in `wpmu_signup_blog_notification()` and `wpmu_signup_user_notification()`.
[38961] added a `$user = get_user_by( 'login', $user );` call which was overriding the `$user` string variable for the login name. The change to `$user_login` makes this clear.

Props johnjamesjacoby.
Fixes #38763.
Built from https://develop.svn.wordpress.org/trunk@39203


git-svn-id: http://core.svn.wordpress.org/trunk@39143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-11 22:20:33 +00:00
Dominik Schilling 7819e2b4ba I18N: Introduce a locale-switching function.
With the introduction of user-specific languages in [38705] it's necessary to be able to switch translations on the fly. For example emails should be sent in the language of the recipient and not the one of the current user.

This introduces a new `WP_Locale_Switcher` class which is used for switching locales and translations. It holds the stack of locales whenever `switch_to_locale( $locale )` is called. With `restore_previous_locale()` you can restore the previous locale. `restore_current_locale()` empties the stack and sets the locale back to the initial value.

`switch_to_locale()` is added to most of core's email functions, either with the value of `get_locale()` (site language) or `get_user_locale()` (user language with fallback to site language).

Props yoavf, tfrommen, swissspidy, pbearne, ocean90.
See #29783.
Fixes #26511.
Built from https://develop.svn.wordpress.org/trunk@38961


git-svn-id: http://core.svn.wordpress.org/trunk@38904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 15:36:31 +00:00
Jeremy Felt 555466ab82 Multisite: Replace `get_blog_details()` in inline documentation.
Some documentation is now out of date and some can be replaced with a mention of `get_site()`.

Fixes #37102.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 03:39:29 +00:00
Jeremy Felt 84f25462e1 Multisite: Replace `get_blog_details()` in `get_active_blog_for_user()` with `get_site()`.
Props flixos90.
Fixes #38355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 18:06:29 +00:00
Jeremy Felt 390dc4b345 Multisite: Replace `get_blog_details()` in `add_user_to_blog()` with `get_site()`.
Adds tests for `add_user_to_blog()`.

Props flixos90.
Fixes #38356.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 05:49:29 +00:00
Jeremy Felt 1560fbcbc5 Multisite: Use `get_network()` and `get_current_network_id()` for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
Dominik Schilling 4a6f90db58 Multisite: Allow to set the site language of a new site to English.
An empty string in `WPLANG` is used to define the site language as `en_US`. The `! empty()` check didn't catch this case so that `wpmu_create_blog()` fell back to the network setting.

Fixes #36918.
Built from https://develop.svn.wordpress.org/trunk@38655


git-svn-id: http://core.svn.wordpress.org/trunk@38598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-26 18:39:32 +00:00
Jeremy Felt 58f107fa95 Multisite: Revert [38388].
Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 21:39:29 +00:00
Scott Taylor e5225324a2 Multisite: use `get_current_blog_id()` where applicable, in lieu of plucking the `$blog_id` global from outer space.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 04:55:54 +00:00
Scott Taylor 08233c6aff Multisite: move `get_current_site()` to `load.php` so that it can be used in more places, instead of importing `global $current_site`.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:35:30 +00:00
John Blackbourn ab052361a3 Docs: Correct and clarify various `@since` docs.
Fixes #37562

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


git-svn-id: http://core.svn.wordpress.org/trunk@38142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-04 22:54:31 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Jeremy Felt 53400a885e Multisite: Deprecate `wp_get_sites()`
Defer to the new `get_sites()` replacement, offering fresh (...or cached) `WP_Site` objects via the new `WP_Site_Query`.

Props flixos90.
Fixes #36994.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 03:03:27 +00:00
Jeremy Felt 75a851a3aa Multisite: Remove the output parameter from `get_site()`
Full `WP_Site` objects should be expected from `get_site()` rather than arrays.

In the single (soon to be deprecated) use of arrays for this in core, we can cast the result to `(array)` for back-compat.

See #35791.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 02:48:30 +00:00
Jeremy Felt fc1db9b413 Multisite: Replace `$wpdb->blog` queries in `ms-functions.php` with `get_sites()`
`get_sites()` is now used in:
* `domain_exists()`
* `wp_update_network_site_counts()`
* `get_blog_id_from_url()`

Props spacedmonkey, jeremyfelt.
See #35791.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-02 02:26:29 +00:00
Jeremy Felt a6de56b473 Multisite: Bump `last_changed` cache on site update and creation
When a site is added, updated, or deleted, the `site_ids` cache for a query will no longer be reliable. Bumping `last_changed` will force a new query for site IDs.

See #35791.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-02 00:59:27 +00:00
Jeremy Felt 53b27a9b0b Multisite: Replace `wp_get_sites()` internals with `get_sites()`
`get_sites()` should be considered a replacement for `wp_get_sites()`. Backward compatibility is maintained in the meantime by using `get_site()` to populate the return data with associative arrays rather than `WP_Site` objects.

Props spacedmonkey, flixos90.
See #35791.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 23:39:28 +00:00
Drew Jaynes e0408b36ca Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in wp-includes/ms-functions.php.
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@37540


git-svn-id: http://core.svn.wordpress.org/trunk@37508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:56:27 +00:00
Drew Jaynes dabe5b1467 Docs: Standardize filter docs in wp-includes/ms-functions.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:40:27 +00:00
Jeremy Felt f917022d6f Docs: Update the return type for `get_active_blog_for_user()`
This is now a `WP_Site` object.

See #32450.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 07:50:26 +00:00
Jeremy Felt 80dd53519d Docs: Update the return type for `get_current_site()`
This is now a `WP_Network` object.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 07:28:26 +00:00
Pascal Birchler 52c901d983 Docs: Improve documentation for the `update_welcome_user_email()` filter, introduced in [26538].
See #25598. See #35986.
Built from https://develop.svn.wordpress.org/trunk@36827


git-svn-id: http://core.svn.wordpress.org/trunk@36794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 09:12:27 +00:00
John Blackbourn 55bbcf0391 Networks and Sites: Clarify the docblock for `get_current_site()` so it's clear that it returns the current network object, not anything to do with the current site. As a further exercise, the reader is invited to fix the nomenclature surrounding blogs, sites, and networks in WordPress.
Props ericlewis
Fixes #35414

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


git-svn-id: http://core.svn.wordpress.org/trunk@36260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-14 00:02:25 +00:00
John Blackbourn a5d44337b2 Docs: `@param` fixes for a variety of docblocks.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 01:45:26 +00:00
John Blackbourn 1402c3d8b4 Docs: Miscellaneous docblock corrections.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 06:31:27 +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
Drew Jaynes 81524f3bfc Filesystem: Following the introduction of the `KB|MB|GB|TB_IN_BYTES` constants in [35286], use them in various places in core.
Props sudar.
Fixes #22405.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-21 14:03:25 +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
Drew Jaynes a0bbd154d9 Multisite: Improve two error strings specifying allowed characters in usernames and site names.
Also removes two error strings that were likely never being triggered anyway due to the stricter character matching higher up.

Props atomicjack, bjornjohansen, DrewAPicture.
Fixes #33336.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 17:33:24 +00:00
Jeremy Felt 092478579a MS: Adjust `_network_option()` parameter order, `$network_id` is first.
This better aligns with expectations and matches the structure used by `_blog_option()`. The `_site_option()` functions remain as an appropriate method for working with the current network.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-11 22:44:27 +00:00
Jeremy Felt 49ce208880 MS: Allow for a `blog_upload_space` setting of 0 to restrict uploads.
Previously, an value matching `empty()` would have been bypassed in favor of the default setting for 100MB.

Related #19538, r19639, r19652, where we saw the bug, fixed the bug, and then unfixed the bug so that it was not a surprise in a point release.

See #34037.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 23:15:26 +00:00
John Blackbourn 9daa848297 Correctly set the scheme of the `home` and `siteurl` options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.
Fixes #33620
Props tryon, johnbillion

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


git-svn-id: http://core.svn.wordpress.org/trunk@34881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 21:46:25 +00:00
Jeremy Felt 9926983b66 Revert [34778], continue using `_site_option()` for the current network.
The `_network_option()` parameter order will be changing to accept `$network_id` first. The `_site_option()` functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 17:11:25 +00:00
Drew Jaynes 65133a89c1 Multisite: Introduce `get_subdirectory_reserved_names()`, which returns a filterable list of reserved subdirectory site names.
The function encapsulates the existing `subdirectory_reserved_names` filter and reduces the maintenance burden of keeping the value of (currently) two instances of the same hook in sync.

See #33615.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 04:35:25 +00:00
Scott Taylor 2003bc15ba Multisite: in `wpmu_validate_blog_signup()`, pass `embed` to the array passed to `subdirectory_reserved_names`.
See #32522.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-06 04:05:24 +00:00
Boone Gorges 0e7c1d3b14 Use `wp_installing()` instead of `WP_INSTALLING` constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.
Built from https://develop.svn.wordpress.org/trunk@34828


git-svn-id: http://core.svn.wordpress.org/trunk@34793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 15:06:28 +00:00
Jeremy Felt 54512d64cb MS: Use `*_network_option()` functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:08:26 +00:00
John Blackbourn ea28454867 Deprecate `get_admin_users_for_domain()`. This function has never been used in core.
Fixes #34122

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


git-svn-id: http://core.svn.wordpress.org/trunk@34720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 22:27:24 +00:00
John Blackbourn f33c6a6650 This function is blessed.
Built from https://develop.svn.wordpress.org/trunk@34754


git-svn-id: http://core.svn.wordpress.org/trunk@34719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 22:24:24 +00:00
John Blackbourn d0d9e4c8d8 Deprecate `create_empty_blog()`. This function has never been used in core.
Fixes #34120

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


git-svn-id: http://core.svn.wordpress.org/trunk@34718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 22:10:26 +00:00
Jeremy Felt d5b2929dbb Docs: Clarify `$user` parameter documentation in `wpmu_validate_blog_signup`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 01:33:27 +00:00
Scott Taylor 2c30a11518 After [34577], alter `wp_xmlrpc_server::mw_newMediaObject()` to check upload space in multisite.
See #21292.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-26 19:49:25 +00:00
Boone Gorges 9d7a685a20 Multisite: Don't limit site titles to 50 chars.
This restriction dates from ye olden times, ie https://mu.trac.wordpress.org/changeset/1140.
It is no longer relevant.

Props chriscct7, theode.
Fixes #33973.
Built from https://develop.svn.wordpress.org/trunk@34455


git-svn-id: http://core.svn.wordpress.org/trunk@34419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-23 14:24:24 +00:00
Drew Jaynes c5fede78e0 Docs: Include 'wp-json' in the 4.4.0 changelog entry for the `subdirectory_reserved_names` filter.
'wp-json' was appended to the reserved names list in [34375].

See #33789. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 09:44:27 +00:00
Scott Taylor c60b00fc20 Multisite: as a precaution, make `wp-json` a reserved subdirectory name.
Props austinginder.
Fixes #33789.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 04:21:25 +00:00
Drew Jaynes fd60f500c3 Docs: Add a changelog entry for the addition of 'wp-admin', 'wp-content', and 'wp-includes' as reserved names for the `subdirectory_reserved_names` filter docs.
The new names were introduced in [33952].

See #33615. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 13:26:26 +00:00
Boone Gorges 49803a45f3 Send multisite site/user signup emails via hooked functions.
Site and user signup notifications are moved to the new actions
`'after_signup_site'` and `'after_signup_user'`. Site and user activation
notifications are moved to the existing actions `'wpmu_activate_blog'` and
`'wpmu_activate_user'`.

Props dshanske, thomaswm, jeremyfelt.
See #33587..
Built from https://develop.svn.wordpress.org/trunk@34112


git-svn-id: http://core.svn.wordpress.org/trunk@34080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 03:28:24 +00:00
Scott Taylor 3d8199c4eb Multisite: Don't allow sites to be created with the following reserved slugs: `wp-admin`, `wp-content`, `wp-includes`
Props austinginder.
Fixes #33615.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-08 19:32:24 +00:00
Jeremy Felt c122491c70 Exclude individual site directories when calculating space used for the main site.
* Add an `$exclude` parameter to `recurse_dirsize()`.
* Use this parameter in `get_dirsize()` to exclude `/sites` when on the main site.
* Add tests for main site and switched site.

Props @earnjam, @jeremyfelt.
Fixes #30202.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 00:07:24 +00:00
Jeremy Felt eee4049c92 Usernames in multisite should be restricted to 60 characters or fewer.
Only 60 characters can be stored in the database for a username, which could cause lookup issues when attempting to use similar usernames of extreme length.

Props @DJPaul.
See #17904, Fixes #26784.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-04 05:53:24 +00:00
Dion Hulse 4df2bd0b2a Remove an undeeded space concatenation from `wpmu_validate_user_signup()`.
This was previously used to prevent `strpos()` returning 0, which is not needed after r32942.
See #32444

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


git-svn-id: http://core.svn.wordpress.org/trunk@32921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-26 01:39:25 +00:00
Scott Taylor aaa99969e4 `wpmu_validate_user_signup()` should strictly check against `false` when using `strpos()`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 16:57:26 +00:00
Scott Taylor 5c6b63d3a6 `if` is a statment, not a function.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 20:01:25 +00:00
Scott Taylor f888767c73 `$status` shouldn't be loosely compared to `true` in `wp_xmlrpc_server::wp_deleteComment()`.
`$initial` shouldn't be loosely compared to `true` in `get_calendar()`.
`current_user_can()` shouldn't be loosely compared to `false` in `kses_init()`
`$get_all` shouldn't be loosely compared to `true` in `get_blog_details()`.
`is_array()` and `in_array()` shouldn't be loosely compared in `wpmu_validate_user_signup()`.
`$result` should by strictly compared in `check_ajax_referer()`.
`wp_verify_nonce()` should by strictly compared in `_show_post_preview()`.
`is_user_logged_in()` should not be loosly compared against `false` in `wp-signup.php`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 17:48:26 +00:00
Jeremy Felt 93ff65e677 Improve information displayed in a network's sites list table
* Better support for arbitrary domain/path combinations by displaying the URL in the primary column rather than Path or Domain.
* Show a cached count of total users per site as a more useful data point rather than the first 5 users.
* Clear that cached count of users for a site when a user is added to the site via `add_user_to_blog()`.

Props @ocean90.
Fixes #32434.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-10 06:50:25 +00:00
Scott Taylor 19a3aacc94 Add `@static*` annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor 4d26d999ce Fix doc blocks for `ms-*.php` files.
A few functions can return a conditional instead of an `if`/`else` of `true`/`false`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 21:51:31 +00:00
Sergey Biryukov 77572cf024 Multisite: Add translator comments to default email messages with non-typical placeholders.
props yoavf.
fixes #32263.
Built from https://develop.svn.wordpress.org/trunk@32381


git-svn-id: http://core.svn.wordpress.org/trunk@32351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 09:12:25 +00:00
Jeremy Felt e4bfbcd9c1 Avoid an unexpected object error when syncing global terms
Pass the expected single value, rather than object, when recursively calling `global_terms()`.

Props hauvong.

See #31914, Fixes #31149.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-07 04:14:26 +00:00
Jeremy Felt 5ac75b3b0a Use response code 200 when an existing network user joins a site via invitation.
Pass a response code of 200 to `wp_die()` when a user is successfully added to an individual site after using the `/newbloguser/` URL from an invite email. This is a user facing success message.

Props MikeHansenMe.

Fixes #31224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-22 22:30:25 +00:00
Sergey Biryukov 12f4004989 Replace generic "Dear user" greeting in email notifications with a more personalized one.
props Ipstenu.
fixes #31217.
Built from https://develop.svn.wordpress.org/trunk@31403


git-svn-id: http://core.svn.wordpress.org/trunk@31384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-10 07:47:27 +00:00
Drew Jaynes 9a17233ca1 Fix an inaccurate summary and description in the DocBlock for `wpmu_validate_user_signup()`.
Props ericlewis.
Fixes #31141.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-29 11:46:22 +00:00
Scott Taylor 0f6d0b84d1 Remove unused local vars in `delete_plugins()`, `delete_theme()`, `WP_Date_Query->validate_date_values()`, `global_terms()`, and `WP_Text_Diff_Renderer_Table->_changed()`.
This will clear out the "Unused Code" label in the next Scrutinizer report.

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 21:19:22 +00:00
Scott Taylor fe6b5983df In PHP 5.0.0, `is_a()` became deprecated in favour of the `instanceof` operator. Calling `is_a()` would result in an `E_STRICT` warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Scott Taylor fc843ce4d0 There are some random `add_action()` and `add_filter()` calls littered around some files in `wp-includes/`. These should be moved to `wp-includes/default-filters.php` with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even `SHORTINIT` - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Andrew Nacin 1cf7a49ffd Adjust [29806] and revert [29807] to restore placeholder and email copy order.
Avoids unnecessarily changing a (large, carefully formatted) translated string from 4.0.

fixes #21089.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-05 01:15:26 +00:00
Scott Taylor a0df295f5c Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:24:25 +00:00
John Blackbourn 3a4f742175 Remove the `wp_is_trusted_network()` function pending further discussion on terminology and behaviour.
See #30145

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


git-svn-id: http://core.svn.wordpress.org/trunk@30567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-26 19:27:23 +00:00
Jeremy Felt c47552dc6d Create new $wp_roles object in install_blog() to avoid protected _init() call
Our call to `$wp_roles->_init()` relied on the `__call()` method in `WP_Roles` to handle the link to the protected method. This works back to PHP 5.2.9, when a bug was fixed allowing access to protected methods through this exact approach.

`install_blog()` needs a fresh `$wp_roles` object after `populate_roles()` resets everything in its path. We can create this new object from scratch, effectively doing the same thing with the call to `_init()` via the constructor.

Fixes #29692 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 05:12:22 +00:00
Scott Taylor 892be738b0 Make the docs type for `return` in `wpmu_create_user()` more specific.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 22:33:21 +00:00
Drew Jaynes f8657d5890 Remove redundant and erroneous `@uses` tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Jeremy Felt 027d026077 Introduce wp_is_trusted_network()
A first step to establish concepts around trusted and untrusted networks.

* Will always return false as default.
* Will one day have a filter.

Fixes #30145

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


git-svn-id: http://core.svn.wordpress.org/trunk@30071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 20:56:22 +00:00
Scott Taylor 258496edb6 In the `wp_new_blog_notification()` email template, include the login url.
Props obenland, georgestephanis.
Fixes #21089.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 01:28:16 +00:00
Sergey Biryukov 0e28457536 * Declare $site_mimes before using it in check_upload_mimes().
* Use the same default value for 'upload_filetypes' as on Network Settings screen.

props rmccue.
fixes #29512 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29718


git-svn-id: http://core.svn.wordpress.org/trunk@29492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-07 10:11:17 +00:00
Scott Taylor 0233933f22 `get_blog_details()->post_count` should update on more actions than just `publish_post`.
Adds unit test.

Props 5um17, midxcat, strangerstudios.
Fixes #27952.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 00:53:15 +00:00
Scott Taylor fcd6920bb8 In `is_user_option_local()`, `$user_id` is set conditionally, but never used.
See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-22 19:18:14 +00:00
Andrew Nacin 525b9145f8 Use correct column name. See [27152].
props barry.
fixes #25545.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 03:39:14 +00:00
Andrew Nacin c3ca81ba94 Always decode special characters for email subjects.
props tlovett1, jeremyfelt.
fixes #25346.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 02:44:15 +00:00
Andrew Nacin 5a873ec0c6 Ensure the $path is trailing-slashed in domain_exists().
props ejdanderson, ericmann.
fixes #18209.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 17:32:16 +00:00
Scott Taylor f307aa1eb8 In `remove_user_from_blog()`, avoid a potentially expensive `IN` query before invalidating the reassigned post and link caches.
Props kovshenin.
Fixes #25545. (Again.)


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


git-svn-id: http://core.svn.wordpress.org/trunk@27027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-11 16:28:13 +00:00
Scott Taylor c2adc15b45 Collect the post and link ids that will be reassigned before running the update in `remove_user_from_blog()`. Use `array_walk()` instead of `array_map()` when invalidating the caches for the collected ids.
Props kovshenin.
Fixes #25545.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-09 21:47:12 +00:00
Scott Taylor 274d2925b9 Invalidate the post cache for posts associated with a user who has been removed from a blog in `remove_user_from_blog()`. Adds a unit test.
Props nprasath002 for the initial patch.
Fixes #25545.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-04 04:13:12 +00:00
Drew Jaynes e2a921a6ed Inline documentation for hooks in wp-includes/ms-functions.php.
Props ShinichiN, ericlewis, rzen.
Fixes #25598.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 20:45:10 +00:00
Mark Jaquith 22c6024f9e Remove unnecessarily gendered pronouns.
fixes #26225

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


git-svn-id: http://core.svn.wordpress.org/trunk@26269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-25 02:05:10 +00:00
Scott Taylor da05f7435b For unit tests that call `wpmu_create_blog()`, Blog factory, or installation code that attempts to clear transients: suppress database errors on `setUp` and restore on `tearDown`.
There are a few places in core that were preventing this from working by explicity setting `$wpdb->suppress_errors` to `false`. Instead, they should inherit the value that existed before errors were suppressed.

This allows Multisite unit tests to run without explosive database errors, and allows `$wpdb->suppress_errors` to be overridden all the way down the chain.

Fixes #26102.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-18 20:45:11 +00:00
Sergey Biryukov 74f77b85a6 Use get_current_site() instead of the $current_site global when possible.
props jeremyfelt.
fixes #25158.
Built from https://develop.svn.wordpress.org/trunk@26120


git-svn-id: http://core.svn.wordpress.org/trunk@26032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 03:23:10 +00:00
Drew Jaynes 2d58250bea Improve inline documentation for the `wp_get_sites()` return value.
Fixes #25645.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:58:32 +00:00
Andrew Nacin 8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Drew Jaynes 56f3f3de4e Improve inline documentation for the `wp_get_sites()` return value.
Fixes #25645.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 05:48:09 +00:00
Andrew Nacin 0e959f06dc Live network counts of users and sites for small networks.
props adamsilverstein, jeremyfelt.
fixes #22917.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-25 16:21:09 +00:00
Andrew Nacin 3db7b4a7a3 Revert [25446] now that `wp_blogs`.`archived` is no longer an ENUM field. see #14511.
Built from https://develop.svn.wordpress.org/trunk@25590


git-svn-id: http://core.svn.wordpress.org/trunk@25507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 01:20:09 +00:00
Sergey Biryukov df34477308 Introduce 'offset' parameter for wp_get_sites().
props jamescollins.
see #14511.
Built from https://develop.svn.wordpress.org/trunk@25488


git-svn-id: http://core.svn.wordpress.org/trunk@25409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-19 01:47:09 +00:00
Sergey Biryukov d87a375483 Use wp_parse_id_list() to parse the 'network_id' parameter in wp_get_sites().
props jamescollins.
see #14511.
Built from https://develop.svn.wordpress.org/trunk@25487


git-svn-id: http://core.svn.wordpress.org/trunk@25408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-19 01:20:09 +00:00
Andrew Nacin 1f507db1c0 Proper treatment of the 'archived' field in wp_get_sites(). see #14511.
Built from https://develop.svn.wordpress.org/trunk@25446


git-svn-id: http://core.svn.wordpress.org/trunk@25367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-14 23:10:10 +00:00
Andrew Nacin efdaf1e915 Introduce wp_get_sites(), a long-awaited replacement for get_blog_list().
props jeremyfelt.
see #14511.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-14 21:13:10 +00:00
Scott Taylor 13d5ff7090 * Fill in undefined var in `Tests_Option_BlogOption`
* Add `defined()` check for `BLOGSUPLOADDIR`
* Suppress deprecated function notices for `is_blog_user()` and `get_dashboard_blog()`
* Check existence of `$user` in `wpmu_log_new_registrations()` before arbitrarily making a database query

Fixes all notices in multisite unit tests.

See #25282.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 07:17:11 +00:00
Sergey Biryukov 1834e8c45e Update phpdoc for get_current_site(). props jeremyfelt. fixes #25040.
Built from https://develop.svn.wordpress.org/trunk@25229


git-svn-id: http://core.svn.wordpress.org/trunk@25199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 08:26:08 +00:00
Sergey Biryukov 5f45d9b482 Use an array as a default value for $meta in multisite signup-related functions. fixes #25149.
Built from https://develop.svn.wordpress.org/trunk@25205


git-svn-id: http://core.svn.wordpress.org/trunk@25177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-02 03:33:09 +00:00
Andrew Nacin 7a8981a38c Case insensitivity for is_email_address_unsafe().
props jkudish.
fixes #25046.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-31 04:36:10 +00:00
Andrew Nacin 5a312f71f6 Revert [23307] so new users in multisite are not automatically subscribers on the main site.
props duck_.
fixes #25166 for trunk.
see #15627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-30 16:29:12 +00:00
Sergey Biryukov cbd1895437 Avoid a PHP notice in wpmu_create_blog() if $meta is not passed. props duck_, jeremyfelt, SergeyBiryukov. fixes #20793.
Built from https://develop.svn.wordpress.org/trunk@25127


git-svn-id: http://core.svn.wordpress.org/trunk@25107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 18:57:10 +00:00
Sergey Biryukov fdef243bf6 Deprecate $network_id argument in get_blog_count(). props jeremyfelt. fixes #25129.
Built from https://develop.svn.wordpress.org/trunk@25113


git-svn-id: http://core.svn.wordpress.org/trunk@25094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-24 02:42:10 +00:00
Andrew Nacin 527f73fbb7 Multisite: Add a filter to get_space_allowed() and increase its internal default value to the network default.
props jkudish for initial patch.
fixes #23650.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 20:55:08 +00:00
Ryan Boren f2f939fed4 Pinking shears
Built from https://develop.svn.wordpress.org/trunk@25085


git-svn-id: http://core.svn.wordpress.org/trunk@25069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-22 15:56:08 +00:00
Dominik Schilling 029e4cf3a6 Remove references to unused globals. props jeremyfelt. fixes #24984.
Built from https://develop.svn.wordpress.org/trunk@25018


git-svn-id: http://core.svn.wordpress.org/trunk@25009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-15 03:13:05 +00:00
Ryan Boren 0e923a5c9d Deprecate get_dashboard_blog().
Remove contextual help for Dashboard Site from the network settings screen.

Props sillybean, ocean90
fixes #24838


git-svn-id: http://core.svn.wordpress.org/trunk@24993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-06 16:07:46 +00:00
Andrew Nacin 5c20d1eca1 Remove "special" multisite spam check in the authentication API.
The spamming of a site no longer directly affects a user of said site.

Moves the spam check to the wp_authenticate filter. Networks in need
of enhanced spam-fighting should leverage this same technique.

Allow is_user_spammy() to accept a WP_User object.

props willnorris, brianhogg.
fixes #24771. see #19714.



git-svn-id: http://core.svn.wordpress.org/trunk@24848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 03:23:51 +00:00
Andrew Nacin 483f887c59 SMH.
git-svn-id: http://core.svn.wordpress.org/trunk@24155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-01 18:39:56 +00:00
Andrew Nacin c39b14a486 Better logic for preg_match() calls in ms-functions.php. fixes #24222.
git-svn-id: http://core.svn.wordpress.org/trunk@24130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 14:49:57 +00:00
Ryan Boren 0f304375f9 Fire the update_blog_public action from update_blog_status() instead of update_blog_public(). Pass blog ID and value to the action.
Add code to noindex() to sync the 'public' value in the site options table with the blog_public value in the options table.

fixes #23155


git-svn-id: http://core.svn.wordpress.org/trunk@23794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-25 09:29:58 +00:00
Sergey Biryukov f86b1502a0 Fix fatal error in WP_User_Query when searching users by URL. Move wp_is_large_network() to wp-includes. fixes #23683 for trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@23664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-12 09:19:55 +00:00
Sergey Biryukov de4d2b5e7a Use correct variable. see [23592]. see #21767.
git-svn-id: http://core.svn.wordpress.org/trunk@23595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 22:04:33 +00:00