WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#28578 closed defect (bug) (fixed)

Re-add install_themes_tabs filter

Reported by: ghost1227 Owned by: SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Themes Keywords: has-patch dev-feedback
Focuses: docs, administration Cc:

Description

As I discussed with Andrew in Chicago, while the install_themes_tabs and install_plugins_tabs filters aren't necessarily common use, they do have uses. One of my most-used plugins actually depends on them. As the new theme installation page (and likely the upcoming rework of the plugin installation page) no longer provide these filters (and with good reason), I propose reworking the filters such that rather than the menubar being filterable, the add-new-h2 buttons take their place. The proposed patch implements this change for the themes page, and suits the needs I have for such a filter quite nicely.

Attachments (2)

28578.patch (960 bytes) - added by ghost1227 3 years ago.
28578.2.patch (1.1 KB) - added by ghost1227 3 years ago.
Updated with inline docs and proper context

Download all attachments as: .zip

Change History (23)

@ghost1227
3 years ago

#1 @ghost1227
3 years ago

  • Keywords has-patch dev-feedback added

#2 @nacin
3 years ago

By Andrew he means me.

#3 @ghost1227
3 years ago

By Andrew... I DO mean you ;) I firmly believe in fixing my own bugs!

#4 @SergeyBiryukov
3 years ago

  • Component changed from General to Themes
  • Milestone changed from Awaiting Review to 4.0
  1. The patch should keep the context on 'Browse' string: _x( 'Browse', 'themes' ) vs. __( 'Browse' ).
  2. Filter docs are needed. Since WP_Theme_Install_List_Table is no longer used, I'd suggest copying the docblock from there (with updated defaults) and replacing it with a duplicate hook comment there.

#5 @SergeyBiryukov
3 years ago

  • Focuses docs added

#6 @ghost1227
3 years ago

Can do! Lemme finish what I'm working on, and I'll resub.

#7 @helen
3 years ago

Related, as another dropped filter in themes: #26930

#8 @ghost1227
3 years ago

I can review the linked patch when I update this one if you'd like, but since a patch is provided...

#9 @helen
3 years ago

Separate patch and ticket, just cross-referencing.

#10 @ghost1227
3 years ago

In fairness, me and Andrew are probably the only ones who've ever USED this filter, so I can't really blame anyone for removing it. But I want it back! :P

#11 @SergeyBiryukov
3 years ago

I was also thinking whether we should introduce a new filter instead of repurposing the old one. But it looks like these links are used in the same way the old tabs were used, and have a similar structure, so I guess it makes sense to reinstate the filter.

#12 @ghost1227
3 years ago

I put a lot of thought into that, but the implementation ends up being roughly the same. As such, any other plugins that may happen to utilize this filter won't need much tweaking to be updated for this implementation... as such, I chose to leave the name the same.

#13 @DrewAPicture
3 years ago

For what it's worth, renaming hooks is not without precedent if going that route makes it clearer what's actually filterable in the new context.

See pre_get_search_form, add_option_{$option}, and upload_post_params just to name a few.

#14 @ghost1227
3 years ago

@DrewAPicture I don't think changing the filter name would make it clearer, though someone with more core experience can certainly correct me if I'm wrong. What it DOES hasn't changed, just which tabs on that page it's applied on.

@SergeyBiryukov Little confused on one thing... it's not actually a duplicate hook, so not sure how a duplicate hook comment is relevant. The hook that it's duplicating was actually removed from core with the last update. I'm simply re-adding it in a slightly different spot.

@ghost1227
3 years ago

Updated with inline docs and proper context

#15 @DrewAPicture
3 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

What's left here?

#16 @ghost1227
3 years ago

I could be wrong, but I think I have everything covered...

#17 @SergeyBiryukov
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 29002:

Reinstate 'install_themes_tabs' filter.

props ghost1227.
fixes #28578.

This ticket was mentioned in IRC in #wordpress-dev by Ghost1227. View the logs.


3 years ago

#19 @nacin
3 years ago

In 29634:

Plugin/Theme Uploads: New capabilities; unify UIs; ensure compatibility with old filters.

Introduce upload_plugins and upload_themes capabilities to allow blocking of plugin and theme uploads, versus the old hacky (and not secure) ways of just hiding UI tabs. These are simply meta capabilities that map to install_plugins and install_themes.

Also:

  • Use the same nice design for the plugin upload screen as the theme upload screen.
  • Better compatibility for the old install_themes_tabs filter added in [29002]. see #28578.
  • Ensure using the install_plugins_tabs filter to remove the upload tab removes the new button.
  • Use 'Add Plugins' instead of 'Install Plugins' to match 'Add Themes'.

fixes #29236.

#20 @nacin
3 years ago

The 'browse-themes' button wasn't an old tab. It's just there for UI "back" purposes. There's no need to pass it through the filter.

#21 @DrewAPicture
3 years ago

In 30772:

Tweak formatting in the DocBlock for the install_themes_tabs hook.

Props kpdesign.
See #28578.

Note: See TracTickets for help on using tickets.