WordPress.org

Support

Support » Plugins and Hacks » Network Plugin Auditor » [Resolved] [Plugin: Network Plugin Auditor] Small error

[Resolved] [Plugin: Network Plugin Auditor] Small error

  • Hi,

    Thanks for the wonderful plugin.

    I have found and fixed a small error: because code does not check if the current column is the custom column added, the plugin displays it’s info at every custom column that may exist.

    Follows fix for functions manage_plugins_custom_column and manage_sites_custom_column:

    function manage_plugins_custom_column( $column_name, $plugin_file, $plugin_data ) {
    		if ( $column_name == 'active_blogs' ) {
    
    			$output = '<ul>';
    
    			// Is this plugin network activated
    			$active_on_network = is_plugin_active_for_network( $plugin_file );
    			if ( $active_on_network ) {
    				$output .= '<li>Network Activated</li>';
    			}
    
    			// Is this plugin Active on any blogs in this network?
    			$active_on_blogs = $this->is_plugin_active_on_blogs( $plugin_file );
    
    			// Loop through the blog list, gather details and append them to the output string
    			foreach ( $active_on_blogs as $blog ) {
    
    				$blog_details = get_blog_details( $blog, true );
    
    				$blog_url  = $blog_details->siteurl;
    				$blog_name = $blog_details->blogname;
    
    				$output .= '<li><nobr><a title="Manage plugins on '.$blog_name.'" href="'.$blog_url.'/wp-admin/plugins.php">' . $blog_name . '</a></nobr></li>';
    			}
    
    			$output .= '</ul>';
    			echo $output;
    		}
        }
    function manage_sites_custom_column( $column_name, $blog_id ) {
    		if ( $column_name == 'active_plugins' ) {
    			$output = '<ul>';
    			// Get the active plugins for this blog_id
    			$plugins_active_here = $this->get_active_plugins( $blog_id );
    			$plugins_active_here = maybe_unserialize( $plugins_active_here );
    
    			foreach ( $plugins_active_here as $plugin ) {
    				$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
    				$plugin_name = $plugin_data['Name'];
    				$plugin_url  = $plugin_data['PluginURI'];
    
    				if ( isset($plugin_url) ) {
    					$output .= '<li><a href="' . $plugin_url . '" title="Visit the plugin url: ' . $plugin_url . '">' . $plugin_name . '</a></li>';
    
    				} else {
    					$output .= '<li>' . $plugin_name . '</li>';
    				}
    			}
    			$output .= '</ul>';
    			echo $output;
    		}
        }

    Regards,
    Gabriel

    http://wordpress.org/extend/plugins/network-plugin-auditor/

Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] [Plugin: Network Plugin Auditor] Small error’ is closed to new replies.
Skip to toolbar