Skip to:
Content

BuddyPress.org

Opened 3 years ago

Last modified 7 months ago

#7368 new feature request

Allow activity stream to be sorted by most recently commented

Reported by: Sweeny Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 2.7.2
Component: Activity Keywords:
Cc: lmoffereins@…

Description

Hello,

By default, the most recent updates in the activiy stream are in the top. Even if there is a recent comment for an older update, that update remains hidden under the top.

What would be ideal is to have the updates in the activity stream sorted by the most recent date, either of the update’s itself or one of its comment’s date. And be displayed together as a group.

I haven't found any possibility to use a filter for a child theme. This would be a great extension.

Change History (8)

#1 @Offereins
3 years ago

  • Cc lmoffereins@… added
  • Component changed from Core to Activity

Hi @Sweeny, welcome to BuddyPress Trac, thanks for your ticket!

You pose an interesting suggestion, which makes sense to look into. For now I'll share this solution I'm using in a project which separates comments from their activity parent to present them as single items in the activity stream, which kind of brings the chronology in.

function prefix_bp_activity_comments_in_stream( $args ) {

        // Force (activity) comment items to be displayed in the stream. The
        // default is 'threaded', which stacks comments to their parent item.
        $args['display_comments'] = 'stream';

        return $args;
}
add_filter( 'bp_after_has_activities_parse_args', 'prefix_bp_activity_comments_in_stream' );

#2 @slaFFik
3 years ago

  • Keywords dev-feedback added

Also related - plugins was created a long time ago, that is bumping activity items to the top once a reply to is is published: https://wordpress.org/plugins/buddypress-activity-stream-bump-to-top/

Might be a source of inspiration.

But in general, I'm against bumping top level activity item to the top of Activity Stream when a new child comment is added to it. Reason: this will quickly pollute the stream and will make it hard to read new things in it.
This opens a possibility for a new "Hot" or "Most Discussed" tab in Activity Directory navigation.

BUT if you are talking about reversing the order of child comments to an activity element - that's a whole another story, and I'm pretty sure it can be filtered with the current filter we have (it's a matter of changing ASC to DESC for the order by date) - BP_Activity_Activity::get_activity_comments() 1434. You can switch to using old query via bp_use_legacy_activity_query and have ability to filter it. In newer implementation - you can't :(.

@boonebgorges
What about adding a filter for return $comments in that method? We will be able to alter that array and reverse the order, for example.

#3 @Sweeny
3 years ago

@Offereins
Thanks for your code.

@slaFFik
Would be nice to have possibility to configure it. Not everybody would like to bump top level activity items. I know.

The plugin https://wordpress.org/plugins/buddypress-activity-stream-bump-to-top/ isn't working anymore.

Kind regards
Alex

#4 @boonebgorges
3 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to Under Consideration
  • Summary changed from Filter / sorting Activity stream to Allow activity stream to be sorted by most recently commented

I agree that it'd be nice to be able to configure the "newest" behavior: "most recently posted" vs "most recently active" or something like that. Unfortunately, this is technically impossible at the moment: the way our activity data is stored, there's no way to sort by "most recently active" without actually bumping the date_recorded value on the top-level activity item. We'd probably need to introduce a date_updated column or something like that. Do others think that this is feasible?

What about adding a filter for return $comments in that method? We will be able to alter that array and reverse the order, for example.

Sure, a filter on the return value of this method seems OK to me. I don't think it solves what @Sweeny is asking for, but I can see it being useful for other purposes.

#5 @Sweeny
3 years ago

@boonebgorges
Thanks!
Introducing a date_updated column or something like that would be great.

#6 @Sweeny
3 years ago

@boonebgorges, @Offereins, @slaFFik

What can I do? Any news for this feature request?

Kind regards
Alex

#7 @DJPaul
2 years ago

  • Milestone changed from Under Consideration to Future Release

#8 @Sweeny
7 months ago

Hi,

any news here?

Kind regards

Alex

Note: See TracTickets for help on using tickets.