The MU forums have moved to

sitewide-tags plugin with comments? (1 post)

  1. sepp88
    Posted 14 years ago #

    hey guys,

    the help in this forum was really awesome so far. thanks for that again.

    as you may have read on a lot of posts before, i'm using the sitewide-tags plugin by donncha. it's absolutely fantastic.
    i just need one little change in the code that might enable comments on the TAGS blog as well.

    i was struggling with google and searched for weeks to find this...

    i found this awesome piece of code that does almost exactly what i want for my sitewide tags plugin.

    function 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;
      $base = $wpdb->base_prefix;
      list($post_blog_id,$post_id) = explode('.', $post->guid);
      $r = $wpdb->get_col("SELECT comment_count FROM $base{$post_blog_id}_posts WHERE ID=$post_id");
      if (is_array($r)) return $r[0];
      return $count;
    add_filter('get_comments_number', 'sitewide_tags_get_comments_num');

    if i add these few lines of code to the site-wide tags plugin, i get almost all comments collected on my mainblog as well.

    so if i have multiple subblogs which posts get collected on my mainblog, the comment-status is shown as well on my mainblog. that's exactly what i want. however, the only thing that now doesn't work anymore are the comments of the mainblog-posts itself???

    so if i post an article right from the backend of my MAINBLOG and i write a comment, my mainblog says "no comments", even though i wrote one.

    so if i delete the code again from my sitewide tags plugin, my mainblog article says "1 comment"...that's funny. i just want all posts to show how many comments are added.

    propably it's a simple line of code, or a simple change in the code above. maybe you know what to do. unfortunately i have no idea. i guess i just need to do an if/else statement right within the added funciton that asks if a comment comes from the mainblog or a subblog.

    i guess that plugin with working comments could help a lot of people.
    maybe you have any ideas!

    thank you so much

About this Topic

  • Started 14 years ago by sepp88