Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#14874 closed enhancement (wontfix)

Add New Filter to validate_current_theme

Reported by: transom's profile transom Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Themes Keywords: theme has-patch
Focuses: Cc:

Description

I am finding that as I build more complicated themes, I need to check for prerequisites (certain plugins, php5, whatever). The current function has no means of catching the theme activation and checking.

Attached is a patch that add a new validate_current_theme_requirements to the function. The patch also modifies the wp-admin/themes.php to check for a WP_Error result and output the provided error.

Attachments (1)

validate_current_theme.diff (2.5 KB) - added by transom 14 years ago.
Diff to wp-includes/theme.php and wp-admin/theme.php

Download all attachments as: .zip

Change History (6)

@transom
14 years ago

Diff to wp-includes/theme.php and wp-admin/theme.php

#1 @nacin
14 years ago

Interesting idea. I wonder if changing the return value for validate_current_theme can cause problems, however.

#2 @transom
14 years ago

  • Keywords has-patch added

#3 @transom
14 years ago

It is an interesting issue. My case would be that returning a WP_Error object and delivering the results in the theme.php file is more WordPress-like in it current incarnation than a generic true/false.

If it is felt that there might be enough plugins that break with this change, but the patch is desirable. We are then left with the "ugly" need to deprecate another function in favor of a new function.

I would suggest that the output of the current function is so useless as to be not used by many (if any) plugins/themes out there. It is kind of an obscure corner of WordPress.

I see that 1) there haven't been any changes in this part of the code since 2008 and 2) this change would allow better documentation for the case of a missing Default theme. (##11282, #14175)

#4 @westi
14 years ago

  • Cc westi added

Adding a filter here is a bad idea.

Your adding the check in completely the wrong place.

We could/should add an activation hook themes could use.

However, a theme should gracefully degrade and work in all scenarios.
If plugins are missing then the theme should add an admin notice and let the user know without causing any php errors / WSOD on the frontend.

#5 @nacin
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

wontfix on this. The activation hook will come from elsewhere.

Note: See TracTickets for help on using tickets.