Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#21099 closed defect (bug) (fixed)

The 'allowed_themes' filter has disappeared

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 3.4.2 Priority: normal
Severity: normal Version: 3.4
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

r20029 deprecated the get_allowed_themes() function and replaced it with wp_get_themes( array( 'allowed' => true ) ). This also removed the allowed_themes filter.

  1. Is there a replacement filter?
  2. If not, can the allowed_themes filter be reinstated?

Attachments (3)

21099.patch (556 bytes) - added by SergeyBiryukov 13 years ago.
21099.2.patch (708 bytes) - added by SergeyBiryukov 13 years ago.
21099.3.patch (1.1 KB) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (17)

#1 @johnbillion
13 years ago

And just to add a little more context, the allowed_themes filter could previously be used to filter the themes shown on the Themes screen on sites within a network. This is no longer possible.

#2 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.4.2

Yeah, this should be added back to WP_Theme. Seems like WP_Theme::get_allowed() would make the most sense, as there was no filter in wpmu_get_blog_allowedthemes() or get_site_allowed_themes().

#3 @SergeyBiryukov
13 years ago

  • Keywords has-patch added

#4 follow-up: @SergeyBiryukov
13 years ago

In 3.3, only get_site_allowed_themes() part was filtered:
http://core.trac.wordpress.org/browser/tags/3.3.3/wp-admin/includes/theme.php#L149

The patch assumes that it would make sense to filter the whole returned array.

#5 @scribu
13 years ago

  • Cc scribu added

#6 in reply to: ↑ 4 @nacin
13 years ago

Replying to SergeyBiryukov:

The patch assumes that it would make sense to filter the whole returned array.

Not sure that's a good assumption. The filter only acts on a network-wide array, with no context for the blog_id being requested.

We should add in some new filters.

#7 @SergeyBiryukov
13 years ago

21099.2.patch is another take.

allowed_themes should mirror the 3.3 behaviour. site_allowed_themes is a new filter, which passes $blog_id for context.

#8 follow-up: @scribu
13 years ago

Wouldn't the 'site_allowed_themes' make more sense inside the get_allowed_on_site() method?

#9 in reply to: ↑ 8 @SergeyBiryukov
13 years ago

Replying to scribu:

Wouldn't the 'site_allowed_themes' make more sense inside the get_allowed_on_site() method?

Indeed. Added network_allowed_themes as well for consistency.

#10 @lancewillett
13 years ago

  • Cc lancewillett added

#11 @nacin
13 years ago

In [21686]:

Restore the 'allowed_themes' filter.

This filter has wrapped the network-wide themes, outside of the network-wide
allowed function (dating back to MU), hence the unusual placement. This restores
previous behavior; we will introduce new filters to enable greater flexibility.

see #21099.
for trunk.

#12 @nacin
13 years ago

In [21699]:

Restore the 'allowed_themes' filter.

This filter has wrapped the network-wide themes, outside of the network-wide
allowed function (dating back to MU), hence the unusual placement. This restores
previous behavior; we will introduce new filters to enable greater flexibility.

see #21099.
for the 3.4 branch.

#13 @nacin
13 years ago

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

#14 @lkraav
10 years ago

Could someone enlighten me on why this filter was chosen not to run on single-site?

I'm sharing the plugins + themes folder among multiple sites, for optimum management, and would like to restrict the Appearance > Themes output via a simple mu-plugin.

Note: See TracTickets for help on using tickets.