WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to show the total number of favorites for each individual activity post next to the favorite button just like it shows the number of comments right next to the comment button. Is this possible to implement?

share|improve this question

closed as off-topic by Pieter Goosen, kaiser Jun 1 '14 at 13:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.