WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 years ago

#24209 closed enhancement (worksforme)

Install Themes/Plugins Custom Page Hooks

Reported by: amereservant Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Administration Keywords:
Focuses: Cc:

Description

Upon trying to add a custom page to the Plugins > Add New section for private plugins, I realized there wasn't a hook that allowed overriding the plugin_api call.

The custom tab on the page could easily be added via the install_plugins_tab filter, but in the class-wp-plugin-install-list-table.php class method prepare_items(), there isn't a hook to override the api call.

I checked the functions for the themes and it's the same thing, so I've added the patches containing the proposed filters for both classes in order to help future customization of WordPress by developers.

Here's an example of the custom tab and the desired results via the hooks in a plugin:

http://i.imgur.com/iF9gbMf.png

These filters can also be used to prohibit clients from adding 3rd-party plugins for security & performance reasons and even limit them to only using a private Repository API.

Thanks!

Attachments (1)

24209.patch (889 bytes) - added by amereservant 6 years ago.
Filter Hooks for Plugins and Themes

Download all attachments as: .zip

Change History (4)

@amereservant
6 years ago

Filter Hooks for Plugins and Themes

#1 @SergeyBiryukov
6 years ago

I realized there wasn't a hook that allowed overriding the plugin_api call.

Indeed. There are filters in plugins_api() and themes_api(), but they are not helpful here, since the API call is not performed at all for custom tabs due to the return in line 91:
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/includes/class-wp-plugin-install-list-table.php#L86

#2 @SergeyBiryukov
6 years ago

  • Component changed from Upgrade/Install to Administration

#3 @chriscct7
4 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Since 3.7 there's filters for this:
For plugins use install_plugins_table_api_args_$tab
For themes use install_themes_table_api_args_$tab

Note: See TracTickets for help on using tickets.