Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem when taking activity comment system to instead of blog comment system


  • marcusyong
    Participant

    @marcusyong

    buddypress activity comment system, is so great, I ‘m sure it ‘s better than blog comment system.

    So I’d like to take buddypress activity comment system to instead of blog comment system.

    My first solution is to apply one plugin: buddypress-activity-as-blog-comments
    within this pluging, there’s a function: bp_activity_blog_comments_template( $file = ” ), to filter the new_blog_post and its comments,

    but there’s a problem, all comments are appearing all at once, no pages, it’s not good.

    So I’d like to filter the activity_comment towards to the new_blog_post, instead of the new_blog_post with its comment.
    in this way, all activity_comment can be pages, or “load more” will apear.

    but I’m very poor in coding,
    I can’t filter the activity_comment,
    who can hell me?

    following is my code in theme: single.php

    <?php get_header(); ?>
    <div id=”content”>
    <div class=”padder”>
    <?php do_action( ‘bp_before_blog_single_post’ ); ?>
    <div class=”page” id=”blog-single” role=”main”>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    …. ….
    <?php comments_template(); ?>

    // my code
    <div class=”activity” role=”main”>
    <?php do_action( ‘bp_before_activity_loop’ ); ?>

    <?php
    global $bp,$wpdb;
    $object = $bp->blogs->id;
    $primary_id = (int) $wpdb->blogid;
    $post_id = get_the_ID();
    $post_activity_id = bp_activity_get_activity_id( array( ‘component’ => $object, ‘type’ => ‘new_blog_post’, ‘item_id’ => $primary_id, ‘secondary_item_id’ => $post_id ) );

    $a_id = array();
    $post_activity_childrens = $wpdb->get_results( “SELECT id FROM {$bp->activity->table_name} WHERE type = ‘activity_comment’ AND secondary_item_id = ({$post_activity_id})”);

    foreach( (array) $post_activity_childrens as $child ) {
    $a_id[] = $child->id;
    }

    $params = array(‘per_page’ => ‘6’, ‘in’ => $a_id);
    ?>

    <?php if ( bp_has_activities( $params ) ) : ?>
    …….
    <?php while ( bp_activities() ) : bp_the_activity(); ?>
    <?php locate_template( array( ‘activity/entry.php’ ), true, false ); ?>
    <?php endwhile; ?>
    …. ….

Viewing 2 replies - 1 through 2 (of 2 total)

  • marcusyong
    Participant

    @marcusyong

    I strongly suggest if buddypress can provide a function, which can help filter activity through itme_id or sencondary_item_id?

    who can help me solve above problems?

    your reply is highly highly highly appreciated.
    thanks!!!!


    marcusyong
    Participant

    @marcusyong

    I testing above code with :WP 3.5.2 BP 1.7.3

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem when taking activity comment system to instead of blog comment system’ is closed to new replies.
Skip to toolbar