Musing on a Most Active Bloggers Userlist Control

A CS Forums post from RDCrumbaker who asked how to display all bloggers on a blog home page (my answer is here, btw) got me thinking about the Most Active Users display on the Community Server Forums home page and how to re-purpose that as a “Most Active Bloggers” Userlist Control.


The above is the Most Active Users list on at the time of this writing.  It’s obviously been a slow day on CS Forums when “Best Male Enhancement Pills” can slip in at #10, but you’ve no doubt seen the list and it’s interesting information 99.99% percent of the time.  Here are a few Sunday evening musings on how that list is generated and how we would approach creating a similar list for a community blogs area. 

The Most Active Users list is simply a CSControl:UserList with an “ActiveUsers” querytype property in the control’s QueryOverrides statement.

QueryOverrides QueryType=”ActiveUsers” SortBy=”RecentPosts” SortOrder=”Descending”

Chameleon controls are beautiful in their ability to be tweaked, but that’s only when they support the query property we’re interested in.  It’s also why when developing custom Chameleon controls it is often necessary to create one’s own Post and Thread Query Override controls as well.  The query overrides for the UserList control are



The UserList control is used on the profile pages, as you can guess from “…UserFavorites.”  For the profile page it is simply rendered three times with three different query override properties which, as I said, is one of the beautiful aspects of Ben Tiedt’s Chameleon architecture.

The UserList ActiveUsers DataSource property calculates Forum Posts only, as we’ll see in a moment.  So to create a “Most Active Bloggers” control we’d need a custom UserList control that obtains Weblog post statistics rather than Forum post statistics.  But where do those Forum Post statistics of the last 24 hours come from?

The ActiveUsers SQL query returns top users from the cs_statistics_user table.  Those stats are generated in the cs_system_UpdateSite stored procedure and called from the SiteStatistics.CalculateSiteStatistics() method in conjunction with the SiteStatisticsJob.cs task (the “SiteStatisticsUpdates” task in your cs.config) which caches the statistics to SiteStatistics.ActiveUsers, or CSContext.Statistics.ActiveUsers.  Efficiency permeates Community Server as shown here, with the UserList DataSource populating the Active Users list with

users = new UserSet(csContext.Statistics.ActiveUsers, csContext.Statistics.ActiveUsers.Count);

One interesting option is available to us now that we know the origins of Active User statistics.  The cs_system_UpdateSite stored proc calculates most recent posts with ApplicationType = 0, or Forums.  (Application Types are listed in the cs_ApplicationTypes table.)  Soooo, if we weren’t using our forums “Most Active Users” control we could change that single digit to ApplicationType = 1, for Weblogs.  Then we could drop the UserList control in our blogs app and we’d be done.  Otherwise, knowing the entire process as we now do, it’s not necessarily a simple little mod.  Not hard, of course, but more than “a tweak.”

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.