WordPress.org

Ready to get started?Download WordPress

Forums

How to add additional columns of info to the Super Admin > Sites list of sites? (3 posts)

  1. rlgrobert
    Member
    Posted 3 years ago #

    Hello. I am wondering if there is a method for adding additional/removing unwanted columns of information shown in the list of sites under Super Admin > Sites. Currently in the List View, it displays ID, Domain, Last Updated, Registered, Users, and Mapping. I would like to remove the Registered and Users columns add a column showing the Privacy setting.

    Is anyone aware of plugin or other method for modifying the columns shown?

    Thank you.

  2. David Sader
    Member
    Posted 3 years ago #

    I have the following "mu-plugin" snippets that I use with this plugin:

    http://wordpress.org/extend/plugins/more-privacy-options/

    First you need an add_filter function to remove the unwanted columns and add the Privacy column:

    <?php
    add_filter( 'wpmu_blogs_columns', 'ds_sites_cols', 1 );
    function ds_sites_cols( $sites_columns ) {
    		unset($sites_columns[ 'registered' ]);
    		unset($sites_columns[ 'users' ]);
    
    		$sites_columns[ 'blog_privacy' ] = __( 'Blog Privacy' );
    
    		return $sites_columns;
    }
    ?>

    And then an add_action function to add the privacy settings under the new column heading:

    <?php
    add_action('manage_blogs_custom_column', 'ds_sites_privacy', 1, 2 );
    function ds_sites_privacy( $column, $blog_id ) {
    	if ( $column == 'blog_privacy') {
    		global $blog;
    		if ( '1' == $blog[ 'public' ] ) {
    			echo 'Visible(1)';
    		}
    		if ( '0' == $blog[ 'public' ] ) {
    			echo 'Block Search(0)';
    		}
    		if ( '-1' == $blog[ 'public' ] ) {
    			echo 'Network Members Only(-1)';
    		}
    		if ( '-2' == $blog[ 'public' ] ) {
    			echo 'Blog Users Only(-2)';
    		}
    		if ( '-3' == $blog[ 'public' ] ) {
    			echo 'Admins Only(-3)';
    		}
    	}
    }
    ?>
  3. rlgrobert
    Member
    Posted 3 years ago #

    Thanks, David. I'll try this out.

Topic Closed

This topic has been closed to new replies.

About this Topic