Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sorting activity stream


  • Sweeny
    Participant

    @sweeny

    Hi!

    I am using Buddypress (2.7.2) for generating an activity stream. Every new message is posted in the stream automatically. Comments are synchronizated. Example: A member is commenting an older blog post; his comment on the blog page will be posted in the activity page automatically. But this updated post (older original post and the very new comment) is not pushed upwards in the activity stream (it should be the first post in the activity stream after posting the newest comment). Can I change this sorting (by date of update, not by date of creation)? Do you have any ideas?

    Kind regards

    Alex

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

  • Sweeny
    Participant

    @sweeny

    Hi!

    It’s me again… I haven’t found a solution.

    This code should be working – but he doesn’t. Any ideas?

    add_filter( 'bp_activity_paged_activities_sql', function( $sql = null, $where_sql = null, $sort = null ) {
        $pos = strpos($sql, 'WHERE a.id IN');
        if($pos){
            $in_items = implode( ',', $where_sql['in'] );
            $sql = str_replace('ORDER BY a.date_recorded DESC' ,' ORDER BY FIELD(id,'.$in_items.') ',$sql);
        }
        
        return $sql;
    }, 10, 3 );

    Kind regards
    Alex


    jaroslawistok
    Participant

    @jaroslawistok

    I have the same problem as some posts are 5 years old. Imagine scrolling this back ;o) Nowhere the the answer. I winder that so few notice this ;o(


    danbp
    Moderator

    @danbp

    Take it as example. Read here if it helps:

    Post comments not appearing in activity stream?

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