The MU forums have moved to WordPress.org

How to insert text (or styling) into plugin update-message? Why? Read below... (3 posts)

  1. awarner20
    Member
    Posted 10 years ago #

    Hi all,

    I am trying to figure out how to add some text to the plugin update nags to selected plugins only in the backend. If I can't add text, then I would try to style the individual class="plugin-update"...but I'm not sure how I would isolate specific plugins.

    Why? Because I've customized the code in a couple of plugins and I want to warn myself in the backend that when I upgrade these plugins I need to redo the customizations. I've already inadvertently upgraded a plugin I customized and didn't notice for a week. Good thing the site isn't live yet, but it will be soon:)

    My thought it to put something like "Warning-Customized" with a red background in front of, or after the "Upgrade Automatically" text.

    Can anyone offer any thoughts on how this might be done?

  2. andrea_r
    Moderator
    Posted 10 years ago #

    Oh oh.... the BuddyPress plugin did this recently...

  3. awarner20
    Member
    Posted 10 years ago #

    OK, I found a couple solutions, one worked for some plugins, but broke things on others (not sure why).

    Solution One.
    Insert the function found here into the plugin file. The function looks like this:

    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' );

    I tried this with a few different plugins and could only get it to work on one. When inserting into others, and then refreshing my plugins list in the Dashboard, I would only see a white screen. I checked and double checked that I was pasting it in correctly, but I dunno why it worked on one and not the others.

    So, I tried a simpler solution, but I'm not sure if this is going to cause problems or not...thoughts?

    Solution Two.
    At the top of the plugin file, I added some text to the plugin name and added a some styling around that additional text. So now, the plugin name looks like this:
    Plugin Name: Category Icons <span style="color:#990000;font-size:14pt;"><br />Do Not Auto-Upgrade:<br /> Plugin Modified</span>

    ...and the output looks like this in the Dashboard:
    http://i43.tinypic.com/2wmmn41.png

    Does anyone know if this will cause issues for me down the road?

About this Topic

  • Started 10 years ago by awarner20
  • Latest reply from awarner20