Commit Graph

31339 Commits

Author SHA1 Message Date
John Blackbourn 811e538325 Update links to the user profile editing screen in the admin toolbar when the current logged in user has no role on the current site. Covers single site and Multisite and introduces tests.
Fixes #25162


git-svn-id: https://develop.svn.wordpress.org/trunk@34122 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 17:09:58 +00:00
Drew Jaynes 112a84fe93 Docs: Add missing parameter and return descriptions for `Walker::get_number_of_root_elements()`.
Fixes #33662.


git-svn-id: https://develop.svn.wordpress.org/trunk@34121 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 15:32:46 +00:00
Sergey Biryukov 13382740b9 Escape class attribute in `edit_post_link()` after [34098].
Props Offereins.
See #30563.

git-svn-id: https://develop.svn.wordpress.org/trunk@34117 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 13:00:31 +00:00
Dominik Schilling (ocean90) 08098026ce Passwords: Deprecate second parameter of `wp_new_user_notification()`.
The second parameter `$plaintext_pass` was removed in [33023] and restored as `$notify` in [33620] with a different behavior. If you have a plugin overriding `wp_new_user_notification()` which hasn't been updated you would get a notification with your username and the password "both".
To prevent this the second parameter is now deprecated and reintroduced as the third parameter.

Adds unit tests.

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

(Don't ask for new pluggables kthxbye)

git-svn-id: https://develop.svn.wordpress.org/trunk@34116 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 12:42:34 +00:00
Sergey Biryukov 217c84e613 Docs: Add a changelog entry for the `$class` argument added to `edit_post_link()` in [34098].
Fixes #30563.

git-svn-id: https://develop.svn.wordpress.org/trunk@34115 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 12:19:55 +00:00
Dominik Schilling (ocean90) 0a77429937 Passwords: Trigger a `wp-check-valid-field` event when the password field is filled with a password by `generatePassword()`.
Updates event handler in `wpAjax.invalidateForm()` to support `wp-check-valid-field`.

See #33406.

git-svn-id: https://develop.svn.wordpress.org/trunk@34114 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 10:38:32 +00:00
Scott Taylor c16e8b5616 Add sanity checks in `map_meta_cap()`, return `'do_not_allow'` when posts don't exist.
Adds unit test.

Props ocean90, nerrad, filosofo.
Fixes #23162.


git-svn-id: https://develop.svn.wordpress.org/trunk@34113 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 04:43:48 +00:00
Boone Gorges 5a6f66faad 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..

git-svn-id: https://develop.svn.wordpress.org/trunk@34112 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 03:27:47 +00:00
Scott Taylor a6a03da7f5 Add an argument to `parent_dropdown()`, `$post`, to allow it to be called for an arbitrary post.
Fixes #23162.


git-svn-id: https://develop.svn.wordpress.org/trunk@34111 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 03:19:59 +00:00
Scott Taylor adfd136bee Move `Walker_Category` and `Walker_CategoryDropdown` into their own files via `svn cp`. Remove them from `category-template.php`. Load them in `category.php`. `svn cp` `category.php` over to `category-functions.php`, which also loads now in `category.php`.
See #33413.


git-svn-id: https://develop.svn.wordpress.org/trunk@34110 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 03:09:37 +00:00
Scott Taylor 1ccae571d9 Move `Walker_Page` and `Walker_PageDropdown` into their own files via `svn cp`. Remove them from `post-template.php`. Load them in `post.php`.
`post-template.php` loads after `post.php` in `wp-settings.php`. It could probably also be loaded in `post.php`, but avoiding that for the moment.

See #33413.


git-svn-id: https://develop.svn.wordpress.org/trunk@34109 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 02:58:40 +00:00
Scott Taylor 2d5945f0fc In `wp_link_pages()`, ensure that `$prev` is greater than `0`.
Props betzster.
Fixes #25273.


git-svn-id: https://develop.svn.wordpress.org/trunk@34108 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 02:45:33 +00:00
Boone Gorges 6064924c18 Send password-change email notifications via hook.
`wp_password_change_notification()` is now called at the 'after_password_reset'
action, rather than being invoked directly from the `reset_password()` function.

In order to make it possible to call `wp_password_change_notification()` as a
`do_action()` callback, the function signature has to be changed so that the
`$user` parameter is expected to be a value rather than a reference. Since
PHP 5.0, objects are passed by reference, so `&$user` was unnecessary anyway.

Props dshanske, thomaswm.
See #33587.

git-svn-id: https://develop.svn.wordpress.org/trunk@34107 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 02:44:41 +00:00
boonebgorges 05d4233956 Send comment notification emails via a hooked function.
Previously, `wp_notify_postauthor()` and `wp_notify_moderator()` were called
directly from `wp_new_comment()`, making it difficult to modify or suppress
default notification emails.

Props dshanske, thomaswm.
See #33587.

git-svn-id: https://develop.svn.wordpress.org/trunk@34106 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 02:16:02 +00:00
Scott Taylor a620cd1e34 Turn off `autocomplete` for the `new-post-slug` field.
Props johnbillion.
Fixes #32752.


git-svn-id: https://develop.svn.wordpress.org/trunk@34105 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 02:02:58 +00:00
Dion Hulse 9555882e90 When running on windows systems, normalise the capitalisation of the drive letter for more reliable string comparisons.
Props tyxla
Fixes #33265


git-svn-id: https://develop.svn.wordpress.org/trunk@34104 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:58:03 +00:00
Scott Taylor b52b5893c4 Pass `$r` and `$pages` to the 'wp_dropdown_pages' and 'wp_list_pages' filters.
Props bigdawggi, SergeyBiryukov.
Fixes #23734.


git-svn-id: https://develop.svn.wordpress.org/trunk@34103 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:31:12 +00:00
Scott Taylor 184e058681 Objects are passed by-reference since PHP 5. In `_get_custom_object_labels()`, cast `$object->labels` back to `object` before returning. This function is weird.
Adds unit test.

Props Toro_Unit.
Fixes #33023.


git-svn-id: https://develop.svn.wordpress.org/trunk@34102 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:22:23 +00:00
Scott Taylor 5a93988ca3 Make `WP_List_Table::get_primary_column_name()` public in list table classes that have it.
Fixes #33854.


git-svn-id: https://develop.svn.wordpress.org/trunk@34101 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 01:11:44 +00:00
Scott Taylor 5d0bc76040 Check if the `$post_type` passed to `get_post_type_object()` is a `scalar` value. Non-scalars were producing PHP warnings.
Adds unit tests.

Props Kloon.
Fixes #30013.


git-svn-id: https://develop.svn.wordpress.org/trunk@34100 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-14 00:02:05 +00:00
Jeremy Felt 13dd966554 Multisite: Implement the `get_by_path` method in `WP_Network`.
Move the internals of `get_network_by_path()` to `WP_Network()` and allow network objects to be retrieved by passing a requested domain and path.

Props johnjamesjacoby, jeremyfelt, drewapicture, wonderboymusic.
See #31985.


git-svn-id: https://develop.svn.wordpress.org/trunk@34099 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 23:39:20 +00:00
Scott Taylor f20622f394 In `edit_post_link()`, add an argument for the class attribute that defaults to `post-edit-link`.
Props voldemortensen.
Fixes #30563.


git-svn-id: https://develop.svn.wordpress.org/trunk@34098 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 23:33:30 +00:00
Jeremy Felt 591a9aa73c Multisite: Introduce the `WP_Network` class.
A `WP_Network` object initially matches a row from `wp_site` and is populated with additional properties used by WordPress core. The first iteration is used to retrieve an existing network based on data passed to the class.

* A network can be retrieved by its ID through `WP_Network::get_instance()`, following in the steps of `WP_Post` and `WP_Comment`.
* A network object can be created or completed by passing initial properties in as a standard object to `new WP_Network()`.

Using these methods, we are now able to populate the global `$current_site` during load via this class.

Props johnjamesjacoby, jeremyfelt, drewapicture, wonderboymusic.
See #31985.


git-svn-id: https://develop.svn.wordpress.org/trunk@34097 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 23:30:57 +00:00
Andrea Fercia 34c6893080 Bump H3 headings to H2 on the Writing Settings screen for better accessibility.
Props mrahmadawais.
Fixes #33651.

git-svn-id: https://develop.svn.wordpress.org/trunk@34096 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 16:47:54 +00:00
Helen Hou-Sandi 379dd889c1 Comments: Fix inline edit/reply on small screens.
props ocean90, SergeyBiryukov.
fixes #33596.


git-svn-id: https://develop.svn.wordpress.org/trunk@34094 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 12:46:03 +00:00
Weston Ruter fd1dbfe003 Customize: Remove redundant `aria-label` attributes.
Adds an `$options` array argument to `WP_Screen::render_screen_options()` to allow the `div#screen-options-wrap` element to be omitted when `wrap` value is `false`.

Props afercia, westonruter.
Fixes #33182.


git-svn-id: https://develop.svn.wordpress.org/trunk@34093 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-13 06:15:42 +00:00
Jeremy Felt 276fa7cd09 Tests: Update `Tests_Feed_RSS::test_items` to expect new comment permalink structure.
Introduced in [34075] for posts without comments.

Props netweb.
Fixes #19893.


git-svn-id: https://develop.svn.wordpress.org/trunk@34092 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 23:30:11 +00:00
Boone Gorges 829ae5f4ce Fail gracefully when checking mapped cap against unregistered post type.
Post type objects are reponsible for mapping their capabilities to core caps.
As a result, when the post type is no longer registered, the caps are no
longer mapped. This causes problems when a post is left in the database after
the post type is no longer present, and WP does an 'edit_post' or other cap
check against it: a PHP notice is thrown, and the cap check always fails.

As a more graceful fallback, we map all post-type-dependent caps onto
'edit_others_posts', which allows highly privileged users to be able to
access orphaned content (such as comments belonging to disabled post types),
while minimizing the possibility of unintended privilege escalation.

We also add a `_doing_it_wrong()` notice, so that developers and site
administrators are aware that the cap mapping is failing in the absence of
the registered post type.

Props mitchoyoshitaka, DrewAPicture, imath, codeelite, boonebgorges, nofearinc, SergeyBiryukov, jorbin, dlh.
Fixes #16956.

git-svn-id: https://develop.svn.wordpress.org/trunk@34091 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:26:57 +00:00
Boone Gorges 4fdfdb6078 Use stricter sanitization for meta query clause keys.
By forcing all clause keys to be strings, we make it possible to use strict
comparison when validating values of 'orderby' as passed to `WP_Query`. This
eliminates situations where the presence of numeric clause keys could result
in an improperly validated 'orderby' value.

Props nikolov.tmw.
Fixes #32937.

git-svn-id: https://develop.svn.wordpress.org/trunk@34090 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:05:14 +00:00
Boone Gorges dcbd8c6c3d Allow `setup_postdata()` to accept a post ID.
Previously, it accepted only a full post object.

Props sc0ttclark, mordauk, wonderboymusic.
Fixes #30970.

git-svn-id: https://develop.svn.wordpress.org/trunk@34089 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:57:06 +00:00
Boone Gorges 4ebab4dc16 Remove extraneous table join in `get_adjacent_post()`.
Since [29248], a table join has not been necessary to process the
`$excluded_terms` parameter of `get_adjacent_post()`. Aside from adding extra
overhead, this join meant that post records that don't have any corresponding
rows in `wp_term_relationships` were erroneously excluded from results.

Fixes #32833.

git-svn-id: https://develop.svn.wordpress.org/trunk@34088 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:33:07 +00:00
Dominik Schilling (ocean90) ed36c88b73 Revert [34013] and parts of [33970].
* `_WP_Editors::wp_mce_translation()` can't be changed without changing strings in TinyMCE and plugins.
* `\u2026` is escaped by `json_encode()` to `\\u2026`, makes `\u2026` visible in our UI.

See #32875.

git-svn-id: https://develop.svn.wordpress.org/trunk@34087 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 20:02:43 +00:00
Dominik Schilling (ocean90) 07ea6a2334 Themes: Don't use HTML entities for placeholders.
See #32875.

git-svn-id: https://develop.svn.wordpress.org/trunk@34086 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 19:47:53 +00:00
Scott Taylor db3a7133f2 In `wp_insert_post()`, when setting `$post_author`, use `isset()` instead of `! empty()` to allow `0` to be passed as the value for `$post_author`.
Adds unit tests.

Props ericdaams, wonderboymusic.
Fixes #32585.


git-svn-id: https://develop.svn.wordpress.org/trunk@34085 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 18:53:56 +00:00
Scott Taylor ad20c3db4a `WP_Posts_List_Table`: there are a cadre of `edit.php` URLs that are generated by string-building instead of using our handy functions. Create a helper method, `->get_edit_link()` that standardizes the generation and escaping of these URLs.
Props BdN3504 for the initial patch on the ticket.
Fixes #32376.


git-svn-id: https://develop.svn.wordpress.org/trunk@34084 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 17:12:25 +00:00
Scott Taylor 2a72a1f959 Use `table-layout: auto` (instead of `fixed`) on `table.fixed` to ensure that things like date/time don't horrendously wrap on small screens. Before/After screenshots attached to the ticket.
Props gaelan.
Fixes #32691.


git-svn-id: https://develop.svn.wordpress.org/trunk@34083 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 16:03:17 +00:00
Scott Taylor 9eb5abbccb `wp_delete_post()`: add a filter, 'pre_delete_post', to allow bailout from the function if the filter returns a non-null value.
Props boonebgorges.
Fixes #32933.


git-svn-id: https://develop.svn.wordpress.org/trunk@34082 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:58:09 +00:00
Scott Taylor 8ef82f4792 `sanitize_post()`: the default value for `$context` is 'display'. The documentation says the default for `sanitize_post_field()` is 'display', but there is no default for the arg. Make the argument: `$context = 'default'`.
Props morganestes.
Fixes #33117.


git-svn-id: https://develop.svn.wordpress.org/trunk@34081 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:45:15 +00:00
Scott Taylor 0b8101849e `sanitize_post()` is polymorphic, add an `is_array()` check for `$post` before operating on it as an array.
Props morganestes.
Fixes #33118.


git-svn-id: https://develop.svn.wordpress.org/trunk@34080 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 15:37:50 +00:00
Dominik Schilling (ocean90) 250c8a0224 Bundled Themes: Update `Tested up to`.
Props mercime.
Fixes #33794.

git-svn-id: https://develop.svn.wordpress.org/trunk@34079 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 12:46:26 +00:00
Scott Taylor faf87c2ca6 After [34076], fix the logic for `post_status` in months dropdown.
See #21015.


git-svn-id: https://develop.svn.wordpress.org/trunk@34077 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 08:18:18 +00:00
Scott Taylor 927ad00bab List Tables: don't render "extra tablenav" if there are no posts. This includes Bulk Actions, Dates Dropdown, Category Dropdowns, Pagination.
Also ensure that the Months dropdown, when it is shown, shows months from the proper set of posts.

Props egower, CoenJacobs, MikeHansenMe, mehulkaklotar.
Fixes #33824, #21015, #21856.


git-svn-id: https://develop.svn.wordpress.org/trunk@34076 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 08:12:43 +00:00
Scott Taylor b76864660c Comments: `get_comments_link()` should return a link with `#respond` as the hash instead of `#comments` if `get_comments_number()` returns `0`.
Props cgrymala, wonderboymusic.
Fixes #19893.


git-svn-id: https://develop.svn.wordpress.org/trunk@34075 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 07:35:05 +00:00
Scott Taylor 9831fa216c AJAX Reply to Comment: check the `edit_comment` cap when parent comment will be auto-approved.
Props rachelbaker.
Fixes #23939.


git-svn-id: https://develop.svn.wordpress.org/trunk@34074 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 07:18:36 +00:00
Boone Gorges b7c8dbf4a2 Better default values in `WP_Query::get_queried_object()`.
Setting the default value of the `queried_object_id` property to `0` meant
that, when called early enough in the WP bootstrap, `get_queried_object()`
could short-circuit the normal query by fooling it into thinking that the
request was for a page with id 0. Setting the default value to `null` instead
avoids this problem.

Props gradyetc, jazbek.
Fixes #31355.

git-svn-id: https://develop.svn.wordpress.org/trunk@34073 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:36:12 +00:00
Scott Taylor 3cbec930bb Edit Comment screen: remove the "View Comment" button (actually a link) from the publish meta box. Mimic the "Edit URL/Permalink" UI from the Edit Post screen to show the comment link below the screen title, but make it an actual link, not a button.
Props ocean90, DrewAPicture, wonderboymusic.
Fixes #19168.


git-svn-id: https://develop.svn.wordpress.org/trunk@34072 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:19:21 +00:00
Scott Taylor dd55363884 Comments: `comment_link()` currently takes no arguments, yet `get_comment_link()` does. Allow `comment_link()` to optionally take the same arguments.
See #33638.


git-svn-id: https://develop.svn.wordpress.org/trunk@34071 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 03:15:14 +00:00
Scott Taylor 6a262bd6ce Quick Edit: fix an ID attribute name collision by renaming one of the author fields `author-name`.
Props afercia.
Fixes #33770.


git-svn-id: https://develop.svn.wordpress.org/trunk@34070 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 02:34:52 +00:00
Scott Taylor 0f2078bc9e When clicking "Show More Comments" in the Comments meta box on the Edit Post screen, change the click behavior to call a new class method on `commentsBox`, `->load()`, that resets `st` (cool name) to the number of visible `<tr>`s before calling `->get()`. This will account for spam'd and trash'd comments when returning comments at the proper offset.
Props utkarshpatel.
Fixes #33829.


git-svn-id: https://develop.svn.wordpress.org/trunk@34069 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 02:27:50 +00:00
Andrew Ozz f855ddb134 Settings, password field: fix placement of the error icon and removal of the error class.
Props liljimmi, adamsilverstein.
Fixes #33406 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@34068 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 00:09:09 +00:00