Jeff and .NET

The .NET musings of Jeff Putz



My Sites


January 2012 - Posts

Using the Scoring Game from POP Forums with your ASP.NET MVC app

Let me tell you a story of HR-discouraged workplace fun. Back in the day, prior to the crash-and-burn of, we had this thing in the development part of the company called the Scoring Game. I wrote about it a couple of years ago on my personal blog. The long and short of it is that we kept a running total of +/-1’s for virtually anything you can think of, for each participant. This was back in 2006, before it became trendy to do it for everything else on the Internets.

Later, Digg started doing all kinds of voting, and it was really the first active example that I can think of that I used in terms of measuring value of content (yes, slashdot did it, but I never went there). Various forums started doing it. StackOverflow based much of its value on a scoring system, along with achievements. When I worked at Microsoft, I worked on the reputation system that feeds the various MSDN properties. It seems inevitable that I’d have to add something like this to POP Forums.

Originally, I was thinking just in terms of voting up posts, but then I realized that there were actually two things to build. The voting mechanism was one part, but the actual scoring was a second part that should be decoupled from the voting. So the workflow goes like this:

Process Event –> Publish to user profile (optional) –> Get associated awards –> Qualify awards –> Give award

To use the system, you only need only a few lines of code. Use the dependency injection container (Ninject) to get the implementation of PopForums.ScoringGame.IEventPublisher.

Note: Yeah, the forums are currently wired to use ASP.NET MVC’s IDependencyResolver to new-up stuff. I realize that this is suboptimal, and a future version will fix this so you don’t have to commit to the same DI container the forum uses.

var publisher = PopForums.Web.PopForumsActivation.Kernel.Get<PopForums.ScoringGame.IEventPublisher>(); publisher.ProcessEvent("message for feed", user, "TestEventID");

Pretty simple, eh? The first string is the text that will be published to the user’s feed (if the event is set to publish), the second is the PopForums.Models.User object to associate with the event, and the third is the actual event ID. Event definitions are really simple.

Event Definitions

There are three events that are static, permanently built into the system. These are wired into the post voting, and the creation of new topics and posts. So for example, when someone votes up a post, a string of HTML is passed in to the ProcessEvent() method, with the user object associated with the post, and the event ID PostVote. The resulting mention in the user’s profile looks like this:

Profile with events

Events don’t have to be published to the user’s profile, and they don’t even need to assign points. New posts and topic events fall into this category. So what’s the point then? Awards! POP Forums leaves that up to you. Award definitions are super simple as well. Say we wanted to give an award for anyone who made 50 posts. The definition would look like this:

Award definition

We can assign any combination of events to the award. In this case, we look for 50 NewPost events, but we could just as easily require 25 PostVote events as well, for a combined set of conditions.

That’s really all there is to it. You can set up stuff anywhere in your app to record events, and publish them to the user profile. Give points, give awards. Knock yourself out!

POP Forums v9.2.1 posted to CodePlex, adds only Spanish translation

Just wanted to drop a quick note to say that I've got an updated version of our most recent POP Forums drop. The new v9.2.1 adds Spanish along side of Danish, German and English as available languages. It has no new features or bug fixes, so if you have v9.2.0, and you don't need Spanish, these aren't the droids you're looking for.

Want to translate to yet another language? Drop me a line:

POP Forums v9.2 posted to CodePlex, with new languages, post voting and the scoring game

POP Forums v9.2.0 is the third release for the ASP.NET MVC3 version of POP Forums. It is feature complete, stable, and ready for feedback. For previous release notes, see previous releases.

Check out the live preview:

Setup instructions are available in the documentation section.


If you're upgrading from v9.0 or v9.1, simply replace the existing files. You'll also have to run the PopForums4.xto4.2.sql SQL script against your existing database. That script can be found in the database project. It adds a number of new fields and tables.

What's new?

  • Localization: The app can now be easily translated. .resx files included for Dutch (nl) and German (de) so far, in addition to the core English. Can you help with another translation? Contact
  • Vote up posts: Give credit to people who make good posts, see who voted on each post.
  • The Scoring Game: Extensible system that allows you to give users points, and issue awards based on repeated events. For example, you can set up awards based on a number of new posts or topics (both of which record these events).
  • Fix: Weird line breaks in lists when posting from Firefox parsed correctly.

What's next?

We'll get some sample documents around how you can use the scoring game functionality in your own application. Feel free to submit feature requests to the issue tracker or on the sample forum. We're particularly interested to hear if you have any desire for installation via NuGet, and if there's a desire to use a SQL CE database.

Wanted: Language translations for .resx files in open source POP Forums

Starting with v9.2, POP Forums will be fully capable of localization. I'm looking for people who can help translate the .resx file in this open source project, which is fairly straight forward. I'll take help for any language, but I'm particularly interested in:

  • German
  • Spanish (es-ES and es-MX)
  • French
  • Russian
  • Chinese (zh-CN)
  • Arabic
  • Hebrew

If you can help, please drop me a line at Thanks!

More Posts