How can I display the total number of favorites for any particular buddypress activity stream post? [closed]

Unfortunately, it’s not really feasible, based on the current implementation of activity favorites in BuddyPress. BP stores this data in a piece of usermeta called ‘bp_favorite_activities’, which is an array of activity ids. That makes it easy and fast to pull up a list of a given member’s favorite activity items; but it makes it almost impossible to pull up a list of the members who have favorited a given activity item, since the data is stored in serialized arrays and can’t be reliably or quickly queried properly.

If this is something that your site really needs, you might consider writing a small plugin that does the following:

  • creates a custom database table linking activity items and individuals
  • hooks to the bp_activity_add_user_favorite and bp_activity_remove_user_favorite and writes to/deletes from your custom table with the relevant info.

I bet this would be a very popular plugin if you wrote it up and made it publicly available.

If you wrote something really nifty, you might also consider submitting it as a BuddyPress patch.