Pay2Blog additional feature to show extra column in wpmu admin blogs list

I've been using pay2blog for a while now and it's starting to bring in some income, gone are the days where I can offer free blogs to all <strike>indonesian seo bloggers</strike> people. Anti-splog and pay2blog have killed 99.9% of my splog problem.

I have made some pretty advanced modifications to pay2blog using cleverly placed apply_filters and do_actions in the original file so I can use a mod file to allow a user to request a blog for free which may be too much to put here. I describe it here

I have made a recent addition (after taking apart the domain mapping and supporter plugins to learn how) which adds another column to the list of blogs in the dashboard to show if a blog is expired with the date it expired or how many days until expiry. If the blog is a supporter, it shows that too.

here's the code, you can just add it to a php file in your mu-plugins folder.

/* pay to blog mod
May 10 2010 - Andy Bailey
requires : pay-to-blog.php in mu-plugins
install to /wp-content/mu-plugins/
    add_filter('wpmu_blogs_columns', 'clp2b_add_column');
    add_action('manage_blogs_custom_column', 'clp2b_add_column_field', 1, 3 );
function clp2b_add_column( $columns ) {
		$first_array = array_splice ($columns, 0, 2);
		$columns = array_merge ($first_array, array('clp2b' => __('Pay2Blog Expire')), $columns);
		return $columns;
function clp2b_add_column_field( $column, $blog_id ) {
		if ( $column == 'clp2b' ) {
                    $expire = get_blog_option($blog_id,'blog_expire');
                                echo 'Supporter';
                        if($expire < time()){
                            echo '<span class="error">Expired!</span><br />'.date('Y-m-d',$expire);
                        } else {
                            $days = ($expire - time()) / 60/60/24;
                            echo 'Expires in '.intval($days).' days';

Mine is in my mod file which has lots of other code in it and I plan on keeping pay2blog on my system. If you are the forgetful type and likely to delete the original pay2blog file without deleting the mod file, you might want to wrap the add_filter and add_action with




to prevent horrible errors from showing.

It looks like the attached image...

If you don't mind, I'll keep the explantions of why it works for a blog post on my site!

Please correct me on any coding gaffs, I learned all my php from taking apart Wordpress and wpmu dev plugins so you can blame yourselves!

Standing on the shoulders of giants like Andrew Billits and Caffeinated Barry has allowed me to actually start making money with my site so a big fat thanks to WPMU Dev for creating such poetic code, I've learned more from taking apart your plugins than any of the myriad of books on programming I've bought over the past 2 years.

[edit] can't upload php or txt as attachment, so I manually removed all the line breaks. hope it worked