Commit Graph

203 Commits

Author SHA1 Message Date
Scott Taylor
19834a4c21 List Tables: After [35622] and [34271], improve pagination logic when queries are altered.
Props bradyvercher.
Fixes #29870.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 20:25:26 +00:00
Scott Taylor
af0498989c List Tables: After [34728], don't try to infer orderby from query params.
List tables are really good.

Props cklosows.
Fixes #25493.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 20:19:26 +00:00
Scott Taylor
128a9c3acd List Tables: after [34271], account for searches when calculating pagination.
Fixes #29870.


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


git-svn-id: http://core.svn.wordpress.org/trunk@35586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-11 23:14:26 +00:00
Dominik Schilling
122f38f748 List Tables: Define the global $mode variable for Quick Edit savings.
Also remove two unused global imports for `$mode`.

Fixes #34577.
Built from https://develop.svn.wordpress.org/trunk@35518


git-svn-id: http://core.svn.wordpress.org/trunk@35482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 21:29:25 +00:00
Helen Hou-Sandí
6ca92efe23 List tables: Move the view mode switcher into screen options for posts.
Having a view mode switcher nestled within table navigation makes no sense, especially now that it's a sticky user option. While less convenient for frequent switching, there is no evidence as of yet that there is a large userbase of frequent view mode switchers.

Introduces a filter for `view_mode_post_types`, which by default is all hierarchical post types with edit UI on.

props Oxymoron.
fixes #22222.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-22 19:25:25 +00:00
Drew Jaynes
b37bb95aad Administration: Introduce the manage_posts_extra_tablenav action, which fires inside the tablenav for the posts list table, and just outside the "actions" container.
Props hlashbrooke, wonderboymusic.
Fixes #30341.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-18 14:56:23 +00:00
Drew Jaynes
8a386cb24f Docs: Add missing file headers to the list table classes and adjust class DocBlocks accordingly.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-17 15:13:25 +00:00
Sergey Biryukov
1157540283 Replace Quick Edit and Bulk Edit headings with <legend> elements.
Props afercia.
Fixes #34289.
Built from https://develop.svn.wordpress.org/trunk@35234


git-svn-id: http://core.svn.wordpress.org/trunk@35200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-17 00:45:25 +00:00
Sergey Biryukov
7fdbebdd7d In WP_Posts_List_Table, correct the type for $comment_pending_count.
See #11381.
Built from https://develop.svn.wordpress.org/trunk@35223


git-svn-id: http://core.svn.wordpress.org/trunk@35189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-16 18:25:25 +00:00
Scott Taylor
7547dc5125 Posts List Table: ensure that "All" gets the "current" CSS class when applicable.
Props afercia.
Fixes #19609.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 00:09:24 +00:00
John Blackbourn
1e90e58da3 Correct pagination when viewing the 'Mine' link on the post listing screen.
Fixes #19609
Props ocean90

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


git-svn-id: http://core.svn.wordpress.org/trunk@34802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 21:36:25 +00:00
Scott Taylor
594a208753 Post List Table: Ensure that edit.php with no query string produces the proper markup and links in the date column header.
Add 2 methods to `WP_List_Table`, `->get_orderby()` and `->get_order()`. Override the methods in `WP_Posts_List_Table`.

`WP_Posts_List_Table` calls `wp_edit_posts_query()` in `->prepare_items()` which is a wrapper for `wp()`. As such, we can obtain `orderby` and `order` via `get_query_var()`, instead of the URL.

Fixes #25493.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 02:10:25 +00:00
John Blackbourn
2571b6dcec Correct the logic used when determining whether to display the 'Mine' link on post list tables. It should only be shown when the count for the user's posts differs for the total count of posts. is_multi_author() cannot be used because it only considers Posts.
Fixes #19609

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


git-svn-id: http://core.svn.wordpress.org/trunk@34631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-28 19:15:24 +00:00
Scott Taylor
75b1dde362 Posts List Table: check is_multi_author() before attempting to set ->user_posts_count. Also, don't show "Mine" when the count is the same as "All."
Fixes #19609.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-26 06:51:26 +00:00
Scott Taylor
f9c2a88a8a List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used.
Props wonderboymusic, Viper007Bond.
Fixes #21249.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 06:06:25 +00:00
John Blackbourn
f38013229b Implement a 'Mine' link on post listing screens in the admin area for all users who have authored posts. This feature was previously only available to users who cannot edit other users' posts (namely Authors and Contributors).
Props linuxologos, wonderboymusic
Fixes #19609

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


git-svn-id: http://core.svn.wordpress.org/trunk@34324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 17:28:24 +00:00
Scott Taylor
47fead7a38 Post List Table: 'All' view should be selected when appropriate for paged responses.
Props kraftbj, wonderboymusic.
Fixes #33923.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-19 18:17:24 +00:00
Scott Taylor
48d402a395 Posts List Table: Use a more robust technique for calculating $total_items so that pagination still appears when items are removed on the last page of results and ->max_num_pages decreases.
Props A5hleyRich.
Fixes #29870.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 21:18:24 +00:00
Sergey Biryukov
d06f5817f8 Docs: Expand the DocBlock for the WP_Theme::get_edit_link() method, introduced in [34084].
Fixes #32376.
Built from https://develop.svn.wordpress.org/trunk@34238


git-svn-id: http://core.svn.wordpress.org/trunk@34202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 15:01:27 +00:00
John Blackbourn
a5a8ae45a6 Remove outdated references to the preview_post_link filter docs.
See #24345
Props paulwilde

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


git-svn-id: http://core.svn.wordpress.org/trunk@34146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 10:32:31 +00:00
Scott Taylor
54829b6305 Create a function, get_preview_post_link(), to DRY the logic for applying the 'preview_post_link' filter to a URL.
Props TomHarrigan, wonderboymusic.
Fixes #24345.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 04:15:25 +00:00
Scott Taylor
8591f94b0a 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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 17:13:25 +00:00
Scott Taylor
527b5b1405 In WP_Posts_List_Table::column_date(), the order of status and time should be switched. It doesn't make sense for phrases like "Last Modified" to occur AFTER the date. Should be before.
Props johnbillion, wonderboymusic.
Fixes #18641. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@33974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 17:43:24 +00:00
Scott Taylor
c2a0336d22 Instead of [33713], allow WP_Posts_List_Table::get_bulk_actions() to check edit_posts AND delete_posts.
Props DeBAAT.
Fixes #29789.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:12:22 +00:00
Drew Jaynes
e8283a6f88 Docs: The type for the $t_time parameter in the post_date_column_time filter docs should be string, not array.
Props jjeaton
Fixes #33540.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 17:15:21 +00:00
Scott Taylor
b1c00f2653 Posts List Table:
Don't show bulk actions if the user can't edit posts.

Props DrewAPicture.
Fixes #29789.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-23 16:28:28 +00:00
Drew Jaynes
54b2e39fdd Docs: Add a changelog entry for the $post_type parameter added to the restrict_manage_posts hook in [33644].
Props pavelevap
Fixes #17891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 16:12:25 +00:00
Scott Taylor
4254f22c2d In WP_Posts_List_Table::inline_edit(), check that $post_formats[0] is an array before traversing.
Props DrewAPicture.
Fixes #33025.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 20:19:25 +00:00
Scott Taylor
4694c477d3 Custom Post Types:
* Introduce `is_post_type_viewable( $post_type_object )`
* Separate the HTML bits from the translatable bits in the `post` messages array in `edit-form-advanced.php`
* Don't show certain UI pieces when a post is not viewable on the front end

When a custom post type item is not viewable on the front end, we don't want to show links to View it (on the front end) all over the admin. We also want to hide the Preview link, et al. We also want our admin messages to not contain said links.

Custom post types with `public_queryable` set to `false` are not viewable on the front end. 
`'page'` is viewable on the front end, but `'page'` is a `_builtin` type, and `public_queryable` is set to `false` when it is registered - see `WP::parse_request()` for when `public_queryable` gets used.

This is confusing, but also somewhat straightforward: to determine if a post type is viewable on the front end, we can check one way for `_builtin => true` and another way for `_builtin => false`:

`$post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public )`

If a post type is `publicly_queryable`, it's viewable. If that value is `false`, it is viewable if it's a `_builtin` type that is also `public`.

I am in search of edge cases, so this shall land.

Props wonderboymusic, DrewAPicture.
See #17609.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 19:40:25 +00:00
Scott Taylor
3923017f82 The 'restrict_manage_posts' hook currently fires on the Post and Media list tables, but is passed zero arguments. Pass $post_type.
Props sunnyratilal, scribu.
Fixes #17891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-19 06:23:25 +00:00
Scott Taylor
4d34e37311 List Tables:
* In `->handle_row_actions()`, bail immediately if `$primary` and `$column_name` do not match. Saves us a nesting level and avoids declaring code that is unusable.
* In `WP_List_Table::single_row_columns()`, allow `_column_{$name}` to be called dynamically by core to avoid having to override the entirety of `->single_row_columns()` in `WP_MS_Users_List_Table` and `WP_Posts_List_Table`
* In `WP_MS_Sites_List_Table`, `id` is not a column.

Props wonderboymusic, paulwilde.
Fixes #29881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 17:47:24 +00:00
Helen Hou-Sandí
4182df24f8 List tables: Even more robust fallback for the primary column.
Since `WP_List_Table::get_default_primary_column()` can be overridden in a subclass and columns can be further filtered, it is possible to end up with a primary column that no longer exists. This is particularly evident in list tables for custom post types that have been altered via filter.

props ocean90.
fixes #32996.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 16:18:25 +00:00
Drew Jaynes
b2cc4de9b2 Add missing summaries, @access tags, and some parameter descriptions to methods added to WP_Posts_List_Table in 4.3.
See [32740]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 17:49:25 +00:00
Helen Hou-Sandí
9c3bc85649 Ensure error messages look like, well, errors.
props obenland, rachelbaker.
fixes #32475.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-07 23:11:24 +00:00
Helen Hou-Sandí
8eb7f71e6b List tables: A better responsive view.
Instead of truncating columns, the data that's already in the markup can now be toggled into view. Only seems appropriate to celebrate four years of contributing by finally doing the first thing I ever mocked up.

Known issues / concerns:
* Custom list tables that don't define a primary column will show nothing at all. These are not extremely common, as `WP_List_Table` isn't really recommended for plugin consumption, but it happens. We need to come up with some kind of fallback.
* Some visual elements, particularly whitespace, could use refining.
* Needs a11y review.
* Touch performance on iOS feels sluggish - is there anything we can do about that?
* Would this be better accordion-style (only one expanded at a time)?
* Is `wp_strip_all_tags()` good enough for column titles that have HTML in them? It's essentially a workaround for the fact that core's comments column does that for the icon, which maybe it shouldn't. Perhaps worth another ticket, as a markup change would be fairly independent.
* Visual hierarchy is not great when expanded (also worthy of another ticket).
* Quick edit now becomes noticeably more annoying to cancel out of, as you have to scroll all the way down and you lose your position from before it was opened. Again, worthy of another ticket.

props Michael Arestad, helen.
see #32395.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 01:31:25 +00:00
Scott Taylor
587c570efa After [32796], improve the accessibility and markup for instances of touch_time().
Props rianrietveld, afercia.
Fixes #31714.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 19:30:25 +00:00
John Blackbourn
b5973e92ec Introduce a no_terms label for taxonomies. This label is used when indicating that there are no terms in the given taxonomy associated with an object.
Fixes #32150
Props afercia

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


git-svn-id: http://core.svn.wordpress.org/trunk@32904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-25 00:16:27 +00:00
Scott Taylor
b8f49cebee List table views: fix missing current class for "All" when logged in as an author.
Props afercia.
Fixes #32015.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-22 20:39:27 +00:00
Scott Taylor
86beb35f6d Use <button> instead of <a> for non-link links in Quick Edit.
Props afercia.
Fixes #32213.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 21:42:27 +00:00
Scott Taylor
b8eb353590 In WP_Posts_List_Table, move the <th> markup out of ->column_cb().
See #29881, [32740].

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


git-svn-id: http://core.svn.wordpress.org/trunk@32723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-13 15:14:24 +00:00
Scott Taylor
da0400e273 In WP_Posts_List_Table::column_title(), use is_post_type_hierarchical() instead of $this->hierarchical_display in the logic to determine whether the_excerpt() should be called.
Fixes #32187.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-13 14:42:26 +00:00
Scott Taylor
c11e433858 After [32740], in WP_Posts_List_Table::single_row() - $lock_holder is checked but unused, so the call to get_userdata() is unnecessary.
See #29881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 20:48:26 +00:00
Scott Taylor
c1c7a7c14c After [32740], correct doc block typo.
See #29881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 20:29:26 +00:00
Scott Taylor
3f4cadf4aa Override ->single_row_columns() in WP_Posts_List_Table.
Break apart the giant `switch` statement in `->single_row()` into `column_{$column_name}` methods.
To maintain the `->single_row_columns( $item )` interface, add a property, `$current_level`, to allow access to `$level`.

This list table class is now easier to subclass.

Props joehoyle, wonderboymusic.
See #29881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 20:18:24 +00:00
Scott Taylor
da4c3d0fe4 In WP_Posts_List_Table::single_row():
* `get_the_terms()` can return `WP_Error`, so its return value should be checked before traversing.
* Correct the `@param` doc blocks

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 18:50:25 +00:00
Konstantin Obenland
cb39d03501 Improve non-visual feedback for list table items without terms.
Props karpstrucking, afercia.
Fixes #32150.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-11 09:28:31 +00:00
Helen Hou-Sandí
c87224eaf6 List tables: Use a class instead of inline styles for hidden columns.
fixes #32608.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-10 19:47:27 +00:00
Helen Hou-Sandí
3562ac028d List tables: Consolidate <td> output for posts.
see #25408.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-10 14:01:28 +00:00
Drew Jaynes
a69f867738 Fix syntax and add missing return descriptions for inline documentation introduced in [32644] for WP_Posts_List_Table.
See #25408. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 01:42:25 +00:00
Scott Taylor
6a08b00632 Add @access annotations to methods that have no doc block in wp-admin/includes/*.
Makes it easier to search for no doc blocks via `}[\n\t\r ]+(protected|private|public)`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 21:32:24 +00:00