• I have a WPMU which I upgraded to 3.0.1 and have ten bloggers with individual blogs which are being ported to the main blog using the Sitewide Tags plugin.

    http://towerofbabel.com

    I’d like the comments to not be set to “off” on the blog posts when the blog posts are ported to the main blog and to have whatever comments are on the posts on the individual blogs to be forced to the main blog with the posts they’re attached to.

    I’d also like a sitewide recent comments widget which actually displays recent comments from all of the individual blogs, not just the main one.

    I’ve searched high and low for the answers to these issues and have had no success. Can anyone help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I use the following function in the theme’s functions.php to correct the comment count on my Sitewide Tags blog.

    function ds_sitewide_tags_get_comments_num($count) {
      global $blog_id, $wpdb, $post;
      	$tags_blog_id = get_site_option( 'tags_blog_id' );
      	if( !$tags_blog_id || $blog_id != $tags_blog_id ) return $count;
      	list( $post_blog_id, $post_id ) = explode( '.', $post->guid );
      	$base = $wpdb->get_blog_prefix( $post_blog_id );
      	$r = $wpdb->get_col( "SELECT comment_count FROM {$base}posts WHERE ID=$post_id" );
     	if( is_array( $r ) ) return $r[0] + $count;
      return $count;
    }
    add_filter('get_comments_number', 'ds_sitewide_tags_get_comments_num');

    Now, that doesn’t get the actual comments to the main blog, but I don’t need them to. Any post link on the main blog takes reader to the original blog where the comments show normally.

    I use a comment indexer(in mu-plugins) that dupes every comment in the network into its own site_comments table: http://pastebin.com/DDvbJFDb

    Add to the comment indexer a function to display the comments: http://pastebin.com/qa1L47ky

    Then I need only the following snippet anywhere in the network in any theme to show a list of recent comments collected from every post and every site:

    <?php
     display_recent_comments(10,150,'<ul>','</ul>','<li>','</li>');
    ?>

    Remind me to buy you dinner. 😉

    David –

    Do I just copy and past the code from the first pastebin link into a new php file? Is there more to it?

    Also, where in my theme should I put:

    <?php
     display_recent_comments(10,150,'<ul>','</ul>','<li>','</li>');
    ?>

    Thanks, very much, in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Forcing comments to the main blog’ is closed to new replies.