I am currently working on a widget-based website, built entirely on user socialization. Since a reputation system pays off for attracting users, I decided to implement one of these.
Now, I would like to hear some solutions on how should this be implemented the right way (take, for example, Foursquare's badge system).
Basically, I need to be able to do the following:
have a badges table, where I can add, edit and delete badges;
be able to enable and disable a badge;
be able to introduce a new badge, but without writing new code - simply give some parameters to the add badge form regarding what should be followed in order for a user to receive a badge;
be able to give badges in real time - meaning that whenever a user accomplishes whatever it needs to receive a badge, the system should know immediately to give the badge to that user;
also, the system should not be overloaded with "badge listeners" - I believe interrogating each user request with every badge requirements is time consuming;
These being said, I would like to hear your opinions on how to implement the right way a badge system (logic, database schema, methods etc.)
Thank you very much!