Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Activity comments post blank until refresh

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

  • Tbarnes37
    Participant

    @tbarnes37

    I’ve also noticed that there are no AJAX calls occurring to check for new activity, and I don’t know why that isn’t working either, but perhaps that sheds some light on the source of the problem? As with the comments, the AJAX calls are working appropriately outside of my custom template.


    Tbarnes37
    Participant

    @tbarnes37

    I found some custom code in my in-theme ‘activity’ folder and replaced it all with fresh files. The comments then worked! Until… I set ‘scope=groups’ in the has_activities loop. Now the problem is back. Can comments not be enabled while scope is set?


    Tbarnes37
    Participant

    @tbarnes37

    I set up a clean WordPress/BuddyPress install with the same versions, and managed to narrow down the problem a bit. Outside of a BuddyPress group page, I cannot show status updates to the group by default, (as opposed to personal updates.) If I change the has_activities loop’s scope to ‘groups’, then the group posts show up, but the comment AJAX problem returns.

    Is there a way I can get the validation that allows these posts to show up on the group’s page, and make it work in my custom template?


    soran7
    Participant

    @soran7

    I also have the same problem.
    Occurs in hidden group and private group.

    I also hope to resolve this problem.


    Tbarnes37
    Participant

    @tbarnes37

    Hi @soran7

    I’ve narrowed the problem down further and found a hack that works for me. If you look in buddypress-functions.php, there’s a function at line 739 called bp_legacy_theme_new_activity_comment. At line 770 is the process of inserting the new comment into the activity stream.

    It begins by checking if $activities_template->activities[0] is set. I’ve tested this function on an actual group page and found that this returns true, so it’s able to handle the activities effectively. However, on my custom template, this returns false; thus, the new comment data is never inserted. Of course this is separate from the process of saving the new comment to the database, so it makes sense that the comments still show up after refresh.

    I’m still hoping to find a less hacky way to do this, because my current solution messes up other activity stream pages, but I’ve managed to get my custom template working by copying buddypress-functions.php into my theme folder and modifying line 768 to have a ‘groups’ scope.

    So change line 768 from this:
    bp_has_activities( 'display_comments=stream&hide_spam=false&include=' . $comment_id );

    to this:
    bp_has_activities( 'scope=groups&display_comments=stream&hide_spam=false&include=' . $comment_id );

    Hope that helps! And if you’re able to find a better, less damaging way, please let me know. My hangup currently is that even if I manually set $bp->current_action to ‘groups’ in my template, it gets over-written at some point after page load, due to a url check that finds my template to not be at a group home url.


    soran7
    Participant

    @soran7

    You are a genius!!
    I was successful in my template!

    I am very happy problem that was suffering for a long time has been resolved.
    Thank you very much.


    Tbarnes37
    Participant

    @tbarnes37

    Awesome, glad it’s working for you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Activity comments post blank until refresh’ is closed to new replies.
Skip to toolbar