How do I hide the plugin meta line on the plugin page.

I need some help removing or hiding the meta line for the individual plugins on the plugin page. This is the line for each plugin that displays the version number, author and link to the plugin's website.

This to get control over the plugin page on multisite subsites. I'm using Supporter to offer plugins to my users, but I want to clean up what is displayed to them. In a perfect world, the option employed would still display the meta line on the main site, but not on any of the subsites.

Here's a screenshot of the plugin page of our testing subsite. As you can imagine, it would look much better without the meta line:

  • Saunt Valerian

    That's the trouble, I've already investigated the Multisite Plugin Manager and found that it wasn't compatible with Supporter (and I am using Supporter). But since MPM was developed by Aaron, I thought I'd ask here for details on how to hide.

    Though I am going to dig into the code of MPM (but I'm not a coder so I'll probably break something) and see if I can extract the snippet that hides the meta line and then place it in as a mu-plugin. Doing it that way is probably a bad idea though.....

  • Saunt Valerian

    Right, I pulled this out of Aaron's MPM plugin and threw it all by itself into a mu-plugin (hide-plugin-meta-line.php). Didn't seem to have any effect at all... any thoughts? Maybe it doesn't work with WP 3.1.2?

    <?php
    
    //removes the meta information for normal admins
    	function remove_plugin_meta($plugin_meta, $plugin_file) {
    	  if ( is_super_admin() ) {
    			return $plugin_meta;
    		} else {
        	remove_all_actions("after_plugin_row_$plugin_file");
    		  return array();
    		}
    	}
    
      function remove_plugin_update_row() {
    	  if ( !is_super_admin() ) {
        	remove_all_actions('after_plugin_row');
    		}
    	}
    ?>
  • Saunt Valerian

    That blew everything up, maybe I put it in wrong:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/teatrade/public_html/wp-includes/plugin.php on line 166

    Warning: implode() [function.implode]: Invalid arguments passed in /home/teatrade/public_html/wp-admin/includes/class-wp-plugins-list-table.php on line 436

    Here's what I have now

    <?php
    //removes the meta information for normal admins
    	function remove_plugin_meta($plugin_meta, $plugin_file) {
    	  if ( is_super_admin() ) {
    			return $plugin_meta;
    		} else {
        	remove_all_actions("after_plugin_row_$plugin_file");
    		  return array();
    		}
    	}
    
      function remove_plugin_update_row() {
    	  if ( !is_super_admin() ) {
        	remove_all_actions('after_plugin_row');
    		}
    	}
    
    add_filter( 'plugin_row_meta' , array( &$this, 'remove_plugin_meta' ), 10, 2 );
    add_action( 'admin_init', array( &$this, 'remove_plugin_update_row' ) );
    ?>
  • Saunt Valerian

    Mason,

    I put in just the code that you provided directly above in to a mu-plugin and received these errors. The first one was displayed in the header, and the other two were displayed in repeatedly in place of the plugin meta line:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/teatrade/public_html/wp-includes/plugin.php on line 395

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/teatrade/public_html/wp-includes/plugin.php on line 166

    Warning: implode() [function.implode]: Invalid arguments passed in /home/teatrade/public_html/wp-admin/includes/class-wp-plugins-list-table.php on line 436

    I'm running WP 3.1.3

  • Saunt Valerian

    Maybe it is a server thing. I added this as a mu-plugin to my multisite test install (it's a fresh installation of 3.2) and I received the same set of errors.

    Appears in the header:
    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/teatrade/public_html/testbase/wp-includes/plugin.php on line 405

    Appears on the plugin page for each plugin:
    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /home/teatrade/public_html/testbase/wp-includes/plugin.php on line 170

    Warning: implode() [function.implode]: Invalid arguments passed in /home/teatrade/public_html/testbase/wp-admin/includes/class-wp-plugins-list-table.php on line 440

  • Mason

    Ah, sorry, we need to pull out the function's namespace as it's no longer associated with any plugin.

    Give this a shot:

    <?php
    function remove_plugin_meta($plugin_meta, $plugin_file) {
    	remove_all_actions("after_plugin_row_$plugin_file");
    	  return array();
    }
    
      function remove_plugin_update_row() {
        	remove_all_actions('after_plugin_row');
    }
    
    	add_filter( 'plugin_row_meta' , 'remove_plugin_meta', 10, 2 );
    	add_action( 'admin_init', 'remove_plugin_update_row', 1 );
    ?>

    Thanks!

  • Saunt Valerian

    @mason - that work beautifully, but it doesn't isolate the main blog/network control area. Having the meta line visible on the main blog or network area plugin pages is useful since the meta has useful information for the admin (ability to check changelogs, updating).

    Of course, Aaron had to spoil all the hard work you did on this, by chiming in that he wrote it into Supporter! :wink:

    I'm going to upgrade my supporter when it comes out of Beta, thank you for all of this!

  • Mason

    Hiya Saunt Valerian,

    No worries. FYI, the following will show the plugin meta to super admins only:

    <?php
    
    function remove_plugin_meta($plugin_meta, $plugin_file) {
      if ( is_super_admin() ) {
    		return $plugin_meta;
    	} else {
    	remove_all_actions("after_plugin_row_$plugin_file");
    	  return array();
    	}
    }
    
    function remove_plugin_update_row() {
      if ( !is_super_admin() ) {
    	remove_all_actions('after_plugin_row');
    	}
    }
    
    	add_filter( 'plugin_row_meta' , 'remove_plugin_meta', 10, 2 );
    	add_action( 'admin_init', 'remove_plugin_update_row' );
    
    ?>