Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#9553 closed enhancement (fixed)

Allow plugins to add info to the "new version" message

Reported by: johnlamansky's profile JohnLamansky Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7.1
Component: Plugins Keywords: has-patch tested commit
Focuses: Cc:

Description

This patch would allow plugins to insert content directly after the "There is a new version of (name) available" line in the plugin administration, via a new after_plugin_update_row action.

A plugin could hook into this to insert pre-upgrade reminders or instructions, for example. (e.g. for those plugins that store custom files needing to be backed up.) I also would find this new action useful for a plugin I'm developing.

I know it's possible to add another <tr></tr> row using the existing after_plugin_row action, but it would look cleaner to include all upgrade-related information in the same row.

Attachments (2)

update.php.diff (1.4 KB) - added by JohnLamansky 15 years ago.
update.php-2.diff (976 bytes) - added by JohnLamansky 15 years ago.
Uses the hook name recommended by DD32

Download all attachments as: .zip

Change History (8)

#1 @JohnLamansky
15 years ago

  • Component changed from General to Administration

#2 @Denis-de-Bernardy
15 years ago

  • Milestone 2.8 deleted
  • Resolution set to invalid
  • Status changed from new to closed

seems invalid. you can already do more or less the same with existing hooks: on the plugin_row hook (or whatever it is), check if an update is suggested in the update_plugins option.

#3 @JohnLamansky
15 years ago

  • Milestone set to 2.8
  • Resolution invalid deleted
  • Status changed from closed to reopened

There's currently no way to add upgrade-related information directly into the same row as the "There is a new version of (plugin name) available" message.

As I stated in the ticket:

I know it's possible to add another <tr></tr> row using the existing after_plugin_row action, but it would look cleaner to include all upgrade-related information in the same row.

Here's a hypothetical usage example:

Plugin code:

function myplugin_update_reminder( $file ) {
	if ( 'my_file' == $file )
		echo "\n\n<br />Remember to backup this plugin&#8217;s custom files <a href='(url)'>here</a> before upgrading.";
}
add_action( 'after_plugin_update_message', 'myplugin_update_reminder' );

Output example:

<tr><td colspan="5" class="plugin-update">

There is a new version of (plugin name) available. <a href="(url)" class="thickbox">View version 2.0 Details</a> or <a href="(url)">upgrade automatically</a>.

<br />Remember to backup this plugin&#8217;s custom files <a href='(url)'>here</a> before upgrading.

</td></tr>

#4 @DD32
15 years ago

  • Component changed from Administration to Plugins

+1 for this patch. But i'd change the hook to "in_plugin_update_message-{$plugin_file}" myself.

@JohnLamansky
15 years ago

Uses the hook name recommended by DD32

#5 @Denis-de-Bernardy
15 years ago

  • Keywords tested commit added

#6 @ryan
15 years ago

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

(In [11193]) Add hook for adding info to plugin update message. Props JohnLamansky. fixes #9553

Note: See TracTickets for help on using tickets.