I'm maintaining and old PHP based CMS that contains forum software, an article publishing system, among other things - all custom. Now the owners want to implement a global, pseudo real-time (it'll probably just update once every ten seconds or something) activity flow, similar to the one on Facebook:
Right now I'm trying to think of the best and easiest way to implement this in such a way that it can be easily extended to include different kinds of activities (creating blog posts, commenting on photo albums/blog posts, creating or replying to forum threads, publishing articles, etc.)
The front-end bit shouldn't be too hard, what I'm not sure about is how I should set up the events table to accommodate for all the different kinds of events that will be included. All the events will include things like a user ID, a URL, a datetime and an "event type", but I would have to save very different data depending on whether a user created a photo album or if someone replied to a forum thread. How do I solve this?
There are a few approaches you could take with this depending on whether each users' view is unique or not - for example: can they flag certain things as not interesting to them, or do you want to hide items they've already read. (I'm assuming in this answer that all users see the same feed.)
I wouldn't use a separate events table to store "actions" for the following reasons:
You could:
UPDATE: Original poster has confirmed that all users see the same feed contents. Based on that I would recommend the simpest solution is schedule a script that generates a static HTML file of the feed that can be embedded straight into the page where needed (as it doesn't require installing and configuring an in-memory store or a proxy server).