Opened 11 years ago
Closed 9 years ago
#25464 closed defect (bug) (fixed)
Function no_items() returns only one result
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Administration | Keywords: | needs-patch |
Focuses: | Cc: |
Description
Function no_items() is called here:
/wp-admin/includes/class-wp-list-table.php -> line 810
But only when $this->has_items() returns false.
And function no_items() is defined here:
1) /wp-admin/includes/class-wp-ms-themes-list-table.php -> line 162
There is no need for condition because only string "No themes found" will be shown everytime.
2) /wp-admin/includes/class-wp-plugins-list-table.php -> line 167
There is no need for condition because only string "You do not appear to have any plugins available at this time." will be shown everytime.
I am not sure if we should only remove not used strings or make also other logic fixes.
Attachments (1)
Change History (6)
#4
@
9 years ago
- Keywords dev-feedback removed
- Milestone changed from Awaiting Review to 4.4
- Owner set to ocean90
- Status changed from new to accepted
MS Themes List Table: It uses $this->has_items
which is ! empty( $themes['all'] )
, which is not the same as ->has_items()
. Actually, I think the logic is inverted here, it should display "No themes found." if the search result is empty, not "You do not appear to have any themes available at this time.".
Plugins List Table: It uses !empty( $plugins['all'] )
to display "No plugins found." for empty search results. If there are no plugins at all it displays "You do not appear to have any plugins available at this time.". That seems to be right.
Apparently this function is being defined in multiple places all over, but only used in two files:
/wp-admin/includes/class-wp-themes-list-table.php, line 122
/wp-admin/includes/class-wp-list-table.php, line 854.
I think removing the other usages would be quite safe. Attaching a patch for that