Display number of times an activity feed entry has been favorited
In the activity feed, the “favorite” button lets users mark entries as favorite. How can I display the number of times each entry has been favorited. Eg
I saw the same question at stackexchange and it’s answered there
Thanks for the link. For everyone reading this post, the short answer is it isn’t currently possible (or at least not easy to achieve with the current implementation of BP).
… you need to create a plugin for that or hire a dev to do so …
As Boone says it would be well received – in fact it ought to be a core ability after all we’re saying we want to be able to query the dB and produce varying result sets based on data available.
Maybe I’m missing something… ?
But couldn’t you use wp_bp_activity_meta table and meta_key = favorite_count
Then in the activity loop – bp_activity_get_meta( $activity_id, ‘favorite_count’ )
So you need the hooks Boone mentions, but no custom table – unless you want to get specific about who liked what.
thought the issue was how the data is recorded i,e not possible to cross reference to an activity – this is an interesting one to have a look at though as being able to easily look at data and produce stats would be good.
@djpaul was creating something “like” this in his BP Labs plugin. Here’s a link: http://byotos.com/2011/12/19/bp-labs-you-may-like-this/
Hadn’t realised, also Ray said he might work on it so be interesting to run it and see where it’s up to.
Currently, favs are stored as serialized array in wp_usermeta.
The OP is just asking for a total count.
Pretty easy to hook in and ++ / — a count within wp_bp_activity_meta table.
But a custom table would be better, imo,
You could use it for a total count scan.
And you could get specific about favs based all members – not just favs specific to a member as per the serialized array.
AND – get it out of wp_usermeta table – hurrah.!
The use of that table is becoming a real scalability issue.
Things like last_activity in user_meta is slooooow.
I think boone wants to move last_activity for BP 1.7 and use an existing activity table.
So maybe a redo of favorites is a natural task for 1.7 ?
edit – just saw the Paul comment that says:
“During development of BuddyPress 1.7, I’ll be revisiting the Like in BP Labs.”
Well, it’s one of the things I am more interested in to look at adding to core. Of course, just like anyone else, I need to make the case to the rest of the team that there ought to be a Like in BuddyPress, which is why I had a bit of an experiment in my Labs plugin.
If people like the idea for core, I would suggest they think the idea of a Like button through — bearing in mind we are changing how theming will be easier in 1.7 — in terms of where the button(s) should be, what should it do, any options it might merit, how it would replace Activity’s existing Favourite button. Perhaps even think about how it could be implemented in the code, and where the likes should be stored in a database, and how other 3rd party plugins could extend the Like button (I might want to make it work with my Achievements for BuddyPress, for example).
Once you’ve got something meaty, either post it somewhere on the BuddyPress.org forums, or make an enhancement ticket on https://buddypress.trac.wordpress.org/
In addition to displaying the favorite count under each activity item, it would be nice to display a list of usernames who have favourited that item. Each usernames could be linked to the corresponding profile page. Similar to how the Instagram feed currently looks.
I think this would add a new level of engagement to the activity stream.
- The topic ‘Display number of times an activity feed entry has been favorited’ is closed to new replies.