Opened 14 years ago
Closed 14 years ago
#15920 closed defect (bug) (fixed)
List table screens in network admin break if no item is selected for bulk actions
Reported by: | PeteMall | Owned by: | PeteMall |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | General | Keywords: | has-patch commit dev-reviewed |
Focuses: | Cc: |
Description
All list table screens in net admin other than plugins and site-themes break when you select a bulk action and don't select any items.
Attachments (8)
Change History (34)
#5
@
14 years ago
The messages don't distinguish between individual actions and bulk actions, i.e., if I delete two themes, I still get "Theme deleted".
#6
@
14 years ago
We should pass the number of themes affected back and use _n()
.
This can either be a new query arg (n=1, n=5), or just enabled=1
or enabled=5
, versus the generic update
.
#10
@
14 years ago
Just tested against trunk. Everything checks out and works as expected (patch 15920-take3.patch).
#11
follow-up:
↓ 12
@
14 years ago
New patch:
- Removes apparently bogus esc_html() wrappers around
$theme['Stylesheet']
in WP_MS_Themes_List_Table. This is the directory name so it should be pretty safe already, and every usage of it ends up in esc_url() or esc_attr(). If for some reasonesc_html( $theme_key ) != $theme_key
though, this would pose quite a number of problems, as the database would be improperly updated.
- Hides the 'Delete' link for a theme active on the main site.
- Prevents theme deletion for a theme active on the main site.
- Properly resets the request URI arguments.
- Switches to more direct
enabled=N
(etc) messages. Also doesn't show "1" in the string when only one theme is deleted.
I'm still not a fan of this direct-to-DB logic, but I'll let ryan weigh in on the necessity of reworking that into a saner check.
$allowed_themes[ $_GET['theme'] ] = true; update_site_option( 'allowedthemes', $allowed_themes );
#12
in reply to:
↑ 11
;
follow-up:
↓ 13
@
14 years ago
Replying to nacin:
Also doesn't show "1" in the string when only one theme is deleted.
There's actually a slight i18n issue. It's good for English, however in Russian a single form is used for every number ending in 1 (except for 11): 1, 21, 31, etc. Standalone single form (as in “Theme enabled”) only makes sense for 1 item. In other cases (21, 31, ...) the number should be included in the string (as in “%s theme enabled”), but it's still single form. Currently there's no way to do this properly.
So my idea was to use “Theme enabled” for individual actions and “%s theme enabled” for bulk actions if only one item has been selected.
This is probably should go in another ticket, since there are some other messages concerned (e.g. “Item permanently deleted”). I'll create one if I get around to it.
#13
in reply to:
↑ 12
@
14 years ago
Replying to SergeyBiryukov:
This is probably should go in another ticket, since there are some other messages concerned (e.g. “Item permanently deleted”). I'll create one if I get around to it.
Indeed, not a regression, so should be handled elsewhere.
#14
follow-up:
↓ 17
@
14 years ago
According to the gnu gettext manual, that should be handled by a proper Plural-Forms header in your PO file. Thus, 'Item deleted' or 'One item deleted' is fine, as it handles the singular case, and you are then given as many plural forms as you need based on the logic in the Plural-Forms header. Not my area of expertise, but that makes sense to me.
#15
@
14 years ago
site-themes.php might need some of the logic in this patch, based on a quick glance.
See also #15974 -- it needs some nonce checks too.
#17
in reply to:
↑ 14
@
14 years ago
Replying to nacin:
According to the gnu gettext manual, that should be handled by a proper Plural-Forms header in your PO file. Thus, 'Item deleted' or 'One item deleted' is fine, as it handles the singular case, and you are then given as many plural forms as you need based on the logic in the Plural-Forms header.
I've been using the header from that same manual:
Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11) ? 0 : ((n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20)) ? 1 : 2);
Perhaps it can be modified to handle this. Thanks for the hint!
#18
follow-up:
↓ 22
@
14 years ago
I don't know enough to be particularly helpful here, but http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html specifically talks about the optional use of 'One' (no %d) in a singular form, and how that's perfectly fine for languages with advanced plural forms.
#22
in reply to:
↑ 18
@
14 years ago
Replying to nacin:
I don't know enough to be particularly helpful here, but http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html specifically talks about the optional use of 'One' (no %d) in a singular form, and how that's perfectly fine for languages with advanced plural forms.
I was able to sort it out by adding an extra rule for a single item and updating translations. It's great knowing that there's a simple solution if you look at the right place. Thanks again!
Fixed notices on
network/sites.php
andnetwork/users.php
.