Warning Message For Self Customized Plugins

Now and then you have to modify an existing Plugin for your own special needs. But you still get a message if an update exists for the original Plugin. If you modified the Plugin several month ago and you forgot about it, so you update the Plugin and all your modifications are gone. Most of the time you have a backup, but even though it's annoying to upload the customized Plugin again after you realized the original Plugin is not exactly what you want. Therefore you can paste a little function in the specified Plugin to display a warning right after the update message. So you won't forget, that you modified this Plugin a while ago.

plugin-modified-warning-small

function my_update_notice() {
	$info = __( 'ATTENTION! Plugin was modified.', MY_TEXTDOMAIN );
	echo '<span class="spam">' . strip_tags( $info, '<br><a><b><i><span>' ) . '</span>';
}

if ( is_admin() )
	add_action( 'in_plugin_update_message-' . plugin_basename(__FILE__), 'my_update_notice' );

Comments are closed.

11 comments

  1. Valentino

    woah! that's great! I really hate when I accidentally subscribe a customized plugin...

  2. Stephen Cronin

    Nice tip - I've been caught by this before.

    Having said that, I'm trying to be clever about this and create a companion plugin which uses filters (or even JQuery) to manipulate the output of the original plugin, rather than customise the original, where possible (not always possible obviously).

  3. Wallace

    it would be better display automatically the modify date and time as well.

  4. scribu

    I simply add (MODIFIED) to the plugin name, as a heads-up.

    A plugin that automatically detects customizations to plugins before updating them would be interesting.

  5. Peter Kahoun

    Interesting. Wouldn't be simpler to put the message into plugin's description.

    (My way: prefix plugin's version with 666. so updates are not offered and I still know what version I use... And of course, modifications in code are properly marked to be able to upgrade as simply as possible. In my experience, adding actions or hooks instead of mod. a plugin's own code is rarely possible.)

  6. Heiko

    @scribu: plugin/theme modification detection is still one thing i'm latently working on (with lower priority). This is necessary not only to avoid such cases Frank descibed, but also useful to detect modified plugins and/or themes hacked from outside using unknown exploits.
    If this is reliable enough, i'm sure, i will publish it.

  7. ovidiu

    nice.
    for wpmu use is_site_admin instead of is_admin though
    🙂

  8. James John Malcolm

    Excellent!

  9. Brad Touesnard

    I usually add "10." to the plugin version so that the notice to update never comes up. For example, if the plugin is version 2.1.2 I would change it to 10.2.1.2.

  10. Anthony Galli

    The simplest ideas are always the best... 🙂

One pingback

  1. Wordpress Wednesday: 50 Links & Resources from around the web | Wordpress Guerrilla