Tagged: buddypress
Hi,
Thank you for the question.
I am assuming that you are referring to Sitewide activity stream and not the stream on user’s profile.This is doable but there is no good way to achieve it.
I am sharing a proof of concept that will work but I highly discourage using it.
/** * Make BuddyPress activity stream random. * * @author BuddyDev * This is a proof of concept that it is doable. We do not endorse doing it as it is error prone. */ add_filter( 'bp_activity_paged_activities_sql', function ( $sql, $args ) { // Let us find the limit clause. $limits = explode( 'LIMIT', $sql ); // let us break the sql into two parts, one before order by and one after order by. $query = explode( 'ORDER BY', $sql ); $sql = $query[0] . ' ORDER BY RAND() '; if ( count( $limits ) == 2 ) { $sql .= 'LIMIT ' . $limits[1]; } return $sql; }, 10, 2 );
Please put this code in your bp-custom.php and it will make sitewide BuddyPress activity random.
Please let me know if it works for you or not?
Regards
BrajeshYou are welcome.
It’s a pleasure to be of service!Regards
Brajesh
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] display activitys posts randomly’ is closed to new replies.
This topic is: resolved