I'm pretty infatuated with Stack Overflow's badge system, so I decided to cook up a generic framework for adding one to my crossword site. Herein I will present my work in progress for the consumption of my dear readers.
The storage of these badge-awarding rules seemed interesting to me. It'd have to be flexible enough to take data from any part of the site related to a user, and not be a hassle to add new badges or check a user's list of acquired badges. I haven't put the caching in yet, which would form the basis for making awarded badges permanent, instead of calculated on the fly, but it's still pretty fun to work with.