• Resolved brasofilo

    (@brasofilo)


    Researching for this action hook, I found this forum thread and as it is closed, I’m opening a new one to report back.

    David Sader’s code has to be improved. The blog id is passed as the callback parameter and instead of ABSPATH, use the more reliable WP_CONTENT_DIR:

    add_action( 'wpmublogsaction', 'b5f_upload_space_used' );
    function ds_upload_space_used( $blog_id )
    {
        $dir_name = WP_CONTENT_DIR . '/blogs.dir/' . $b_id . '/';
        $size = round( get_dirsize( $dir_name ) / 1024 / 1024, 2 );
        echo '<strong>'. $size . '</strong> MB';
    }

    To give the column a custom name, we use the following:

    add_filter( 'wpmu_blogs_columns', 'b5f_rename_actions_column' );
    function b5f_rename_actions_column( $sites_columns )
    {
        if( isset( $sites_columns['plugins'] ) )
            $sites_columns['plugins'] = __( 'Space used' );
        return $sites_columns;
    }
  • The topic ‘How to use the wpmublogsaction hook?’ is closed to new replies.