Activity Stream Messages are not displayed in descending order in the dashboard

Activity Stream Messages are not displayed in descending order by datetime (recent at the top) in dashboard, Is there any code or administrator setting required to display latest message as first in the list. Thanks!

image

It is weird. By default, it shows records in the descending order.

In admin dashboard, you can option for activity stream settings, but I don’t see any useful settings. :face_with_peeking_eye:

1 Like

I had changed a function used to sort in usort method in SugarFeedDashlet.php. After reverting , the issue got fixed.

Interesting! what did you change in that file?

modules/SugarFeed/Dashlets/SugarFeedDashlet/SugarFeedDashlet.php

Changed function that was supposed to return an integer instead of boolean value. Used wrong integer values for greater than, equal to and lesser than boolean results to take care of a deprecated function in 8.3 PHP.

Used correct values (0,-1 & 1) and it worked. Working code is as follows:

$function = function ($a, $b) {
			$result = -1;
			if($a["sort_key"] == $b["sort_key"]){
				$result = 0;
			} else if($a["sort_key"] < $b["sort_key"]){
				$result=1;
			}
			return $result;
            //return $a["sort_key"] < $b["sort_key"];
};

So, you’re using PHP 8.3? That isn’t supported yet.

If you can file your solution as a PR on Github, I guess it will be useful in the future. :+1:

1 Like

Compatibility matrix 7.x

Thanks for the suggestion. I will look into this.