Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post comments not appearing in activity stream?

  • Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    Hi all,

    I just started working on a production site, with latest wordpress and buddypress installed, but can’t quite figure out why post comments do not appear in activity stream. I have search indexing and allow activity stream commenting on blog and forum posts enabled, but nothing happens. Well, everything else works just beautifuly, except that minor or major issue, lol. πŸ™‚

    Any ideas?

    wordpress: 4.2.4
    buddypress: 2.3.2.1
    theme: mesocolumn
    site: beta.karierist.si

    Your help would be much appreciated, thanks. πŸ™‚

Viewing 14 replies - 1 through 14 (of 14 total)
  • Profile photo of djsteveb
    djsteveb
    Participant

    @djsteveb

    Test this using 2014 theme? With other plugins disabled?
    have you “enabled site tracking” in the buddypress settings?
    ( https://buddypress.org/support/topic/what-does-site-tracking-do/ )

    I think I may have a similar issue, and I think there was a thread about this recently, like in the past 3 weeks or so.. I have not whittled it down to a bp-custom issue, or theme issue, or what yet myself – too busy trying to fix more important things at the moment..

    interested if you find the issue / resolution – hope these tidbits help to find..

    Profile photo of danbp
    danbp
    Moderator

    @danbp

    Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    djsteveb: site indexing is enabled, yes, googled all the topics regarding this issue, but found (for now) now solution for my problem, will explore further, hope you do too πŸ™‚

    danbp: thanks for the link, read it, and will wait a little bit longer to see if the posts and comments appear in the activity stream after a while

    Generally speaking, is this a bug of the buddypress, or something wrong with my site, as i am seeing that this works just fine on other sites?

    Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    danbp: will try your solution, will post feedback here πŸ™‚

    Try this snippet which will force chronological comment display on the SWA.
    install it in bp-custom.php or theme’s functions.php

    Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    Just tested the snippet provided by @danbp, doesn’t work for me, as nothing shows in the activity stream.

    Will do a clean install, with fresh DB, and only wordpress with buddypress, to see if there is something wrong with my current configuration.

    Will post updates, as i am willing to come to the bottom of this issue for the whole community. πŸ™‚

    Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    Just tested with new install of only wordpress and buddypress, all latest versions. Posts and posts comments do not appear in activity stream, sadly.

    It seems there is some inherent bug in the buddypress or something.

    Profile photo of danbp
    danbp
    Moderator

    @danbp

    1. Search Engine Visibility should stay unchecked. See your-site/wp-admin/options-reading.php
    2. Allow people to post comments on new articles: should be checked
      (These settings may be overridden for individual articles.) -> could be set to of by default on some themes. Posts directory > Choose Post > Quick edit > Allow comments. See your-site/wp-admin/options-discussion.php
    3. Site Tracking should be checked. BP Settings > components
    4. Blog & Forum Comments should be checked. BP Settings > settings

    If you’re testing a fresh BP install, add some content so you’ll see how it’s displayed. BP Default Data plugin is ideal for this.

    Profile photo of Bezuhov
    Bezuhov
    Participant

    @bezuhov

    @danbp, thanks for instructions, done all that on a fresh install. πŸ™‚

    Now the posts do appear in activity stream, but not the comments. If i comment on a post, the stream doesn’t show the comments, but if i comment on a post via activity stream, the comment is then seen on a post and on the activity stream.

    Well, i guess i just gonna have to live with that. πŸ™‚

    Profile photo of coffeywebdev
    coffeywebdev
    Participant

    @coffeywebdev

    Take a look at the code below to see how I use the post_comment action to hook my function vp_add_group_activity_comments(), which creates an activity stream item when a user posts a comment and adds it to their group’s activity stream… This is just what we are doing for our site, but if you look at the code you should be able to figure out how to do it for your site….

    
    function vp_add_group_activity_comments($comment_id){
    
    $comment = get_comment( $comment_id );
    GLOBAL $wpdb;
    $user_id = get_current_user_id();
    $user_info = get_userdata( $user_id );
    
    $current_user_group_id = $wpdb->get_var("SELECT group_id FROM ".$wpdb->prefix."bp_groups_members WHERE user_id = '".(int)$user_id."'");
    
    $comment_action = "<a href='".site_url()."/members/".$user_info->user_login."'>".$user_info->first_name." ".$user_info->last_name."</a> posted a comment on <a href='".get_permalink($comment->comment_post_ID )."'>".get_the_title($comment->comment_post_ID)."</a>";
    
    // arguments to pass to the bp_activity_add() function
    $args = array(
    'action'            => $comment_action,                     // The activity action - e.g. "Jon Doe posted an update"
    'content'           => $comment->comment_content,                     // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
    'component'         => 'groups',                  // The name/ID of the component e.g. groups, profile, mycomponent
    'type'              => 'activity_update',                  // The activity type e.g. activity_update, profile_updated
    'primary_link'      => get_permalink($comment->comment_post_ID ),                     // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
    'user_id'           => $user_id,  // Optional: The user to record the activity for, can be false if this activity is not for a user.
    'item_id'           => $current_user_group_id,                  // Optional: The ID of the specific item being recorded, e.g. a blog_id
    'secondary_item_id' => $comment->comment_ID,                  // Optional: A second ID used to further filter e.g. a comment_id
    'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
    'hide_sitewide'     => 0,                  // Should this be hidden on the sitewide activity stream?
    'is_spam'           => 0,                  // Is this activity item to be marked as spam?
    );
    
    $add_activity = bp_activity_add($args);
    
    // Update the group's last activity
    groups_update_last_activity( $current_user_group_id );
    
    return true;
    }  
    add_action('comment_post', 'vp_add_group_activity_comments' );
    
    Profile photo of cmavrikas
    cmavrikas
    Participant

    @cmavrikas

    Dear @danbp,

    I was using the snippet that you proposed for forcing the stream of comments cronologically with success. It seems that with the recent BuddyPress updates it does not work anymore.

    Do you have any idea about that?

    Thank you very much,
    Charalampos

    https://buddypress.org/support/topic/blog-comments-not-appearing-in-activity-stream/#post-186091

    // Force chronological comment display on the SWA

    function bpfr_stream( $qs, $object ) {
    	if ( 'activity' != $object ) {
    		return $qs;
    	}
    	
    	$qs = wp_parse_args( $qs, array() );
    	
    	$qs['display_comments'] = 'stream';
    	
    	return $qs;
    }
    add_filter( 'bp_ajax_querystring', 'bpfr_stream', 20, 2 );
    Profile photo of imath
    imath
    Moderator

    @imath

    Hi there, let’s try to reply to one problem at a time!

    Now the posts do appear in activity stream, but not the comments. If i comment on a post, the stream doesn’t show the comments, but if i comment on a post via activity stream, the comment is then seen on a post and on the activity stream.

    I guess, this means the BuddyPress “Site Tracking” is active.

    1/ WordPress Administration > BuddyPress Settings > Options Tab – Activity Settings section:
    Setting ‘Allow activity stream commenting on blog and forum posts’ is not checked. It means when a post or a comment is posted, then an activity will be generated, but it’s not possible to add an “Activity comment” to the generated activities. Just tested with latest WordPress and BuddyPress 2.5.2 and it works as expected:
    No sync

    2/ WordPress Administration > BuddyPress Settings > Options Tab – Activity Settings section:
    Setting ‘Allow activity stream commenting on blog and forum posts’ is checked. This means you chose to synchronize comments between the Post object and the corresponding activity object. So a comment on the activity about the post will generate a regular post comment and a regular post comment will generate an activity comment on the activity about the Post. Just tested with latest WordPress and BuddyPress 2.5.2 and it works as expected:
    Sync on

    Now @cmavrikas is talking about something else i think. He wants the activity comments to also be displayed like regular activities: in stream mode.
    I then advise to use another filter to avoid parsing args / checking the current object of the Ajax querystring:

    function activity_comments_stream_mode( $args = array() ) {
    	return array_merge( $args, array(
    		'display_comments' => 'stream',
    	) );
    }
    add_filter( 'bp_before_has_activities_parse_args', 'activity_comments_stream_mode', 20, 1 );

    I just tested it, and again it’s working fine in latest WordPress / BuddyPress 2.5.2…

    I advise you to deactivate plugins/come back to a default WordPress theme and do the opposite work to find the plugins or theme that prevents this regular behaviors.

    Profile photo of cmavrikas
    cmavrikas
    Participant

    @cmavrikas

    Hello @imath, I can confirm that the code you are proposing is working fine, thank you!

    May I take the opportunity to ask you, how would it be possible to display not just the most recent comment of an old update on top, but the old update together with all its comments.

    I.e. the stream to display all updates and their nested comments in a chronological way, but the criteria to be the most recent date of either the update or any of its corresponging comments.

    The default stream of BuddyPress hides any new comment deep down nested in its corresponding update. I would like the whole group to come up.

    I hope my english was clear enough!
    Thank you

    Profile photo of cmavrikas
    cmavrikas
    Participant

    @cmavrikas

    Hello,

    how can group activity comments be displayed like regular activities: in stream mode? the code @imath provided works fine for the SWA, but I do not get the same behaviour for group activity stream.

    Thank you

    Profile photo of cmavrikas
    cmavrikas
    Participant

    @cmavrikas

    Hello to everybody and a happy new year!

    I just want to bring back the issue how can group activity comments be displayed like regular activities: in stream mode.

    The code @imath provided works fine for the SWA, but I do not get the same behaviour for group activity stream.

    Thank you!

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Skip to toolbar