Opened 9 years ago
Last modified 5 years ago
#32065 new enhancement
Hide entire RSS widget when no items to display
Reported by: | MadtownLems | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | Widgets | Keywords: | has-patch |
Focuses: | Cc: |
Description
When a default RSS widget has no items to display, the following text is displayed: "An error has occurred, which probably means the feed is down. Try again later."
I don't believe that this message is particularly useful to readers and suggest that in the event that an RSS Widget is - for whatever reason - unable to display any items, that the widget just doesn't appear at all, rather than display an unhelpful and ugly message.
An alternative implementation is to conditionalize this output with something like current_user_can( 'edit_theme_options' ). This would allow users who can actually control Widgets to still see the output, but standard readers wouldn't have to see it.
Attachments (3)
Change History (7)
#2
follow-up:
↓ 3
@
5 years ago
- Keywords has-patch added
In my patch, 32065.diff, I added a new checkbox control in the widget which can be toggled to hide or display the RSS Widget for non-admin users if the RSS feed url has no items to display. By default, this is checked.
Also, like what @MadtownLems mentioned, only the admin users will see the widget with the error message - An error has occurred, which probably means the feed is down. Try again later.
. This is so that the admin can easily know that his / her RSS widget has problems.
#3
in reply to:
↑ 2
@
5 years ago
Replying to donmhico:
In my patch, 32065.diff, I added a new checkbox control in the widget which can be toggled to hide or display the RSS Widget for non-admin users if the RSS feed url has no items to display. By default, this is checked.
Thanks for the patch! I don't think a new checkbox is necessary here, per Decisions, not Options philosophy.
Just checking current_user_can( 'edit_theme_options' )
and returning early if there are no items seems enough.
#4
@
5 years ago
Thanks for the feedback @SergeyBiryukov. I've attached a new patch, 32065.3.diff, that reflects your input.
I think it's a good idea. Did you want to put together a patch to get the conversation started?
Related #23012.