After searching Google and Stackoverflow for similar questions, i still haven't found any solution.
One of the main parts of my site are activity feeds. It show all the actions different users did just like Facebook. I store all the activities in a MySQL table, and render the view with PHP.
I want to group similar activities just like Facebook does:
*Current situation:*
- User A uploaded a picture
- User A uploaded a picture
*Desired situation:*
- User A uploaded 2 pictures
My activity table looks like this:
[Activities]
- i_id
- a_source
- a_type
- a_parent
- a_parent_id
- a_data (json string with meta data, photo filenames for example)
I have found these questions on stackoverflow, but none of them provide a solution:
- https://stackoverflow.com/questions/5844655/how-to-group-similar-items-in-activity-feed-similar-to-facebook
- User activity feed (ala facebook). How to group similar activities?
- How to group similar items in an activity feed
:edit:
I'm looking for an approach and want your thoughts on how to solve this.
Would it be best to run a cron job and group all the same items in the db? Or would it be better to do this on render time with php?
I prefer a (realtime) php solution but then again i don't know where to start.
I just need a starting point for future reading.