Today’s Community Server Favorites – by Post and Section

I’m Day One into a new client project updating a customized CS2008 site to CS2008.5 SP2.  It’s interesting what unanticipated issues you encounter when upgrading a working site.  Today it was the display of User Favorites by "Post" and "Section," two criteria that don’t exist anymore.

In CS2008, separate favorite lists were achieved with a UserData FavoritesShared property of type FavoriteType – Post, Section, None or User.  The FavoriteType enum still exists, but it’s been removed from the User object, which is probably the right call.  In CS2008, separate Post and Section favorite lists were displayed like so.

<CSControl:PostList runat="server" ShowHeaderFooterOnNone="true"
        <CSControl:UserPropertyValueComparison runat="server" Operator="Contains"
             ComparisonProperty="FavoritesShared" ComparisonValue="Post" />

The IFavoriteContent object still has a FavoriteType, but it’s more granular now. WeblogPost, ForumPost, Forum, and so on.  To bring back the old days of the Post and Section I created a custom FavorableContentList control and its own FavorableContentQuery to include a FavoriteType Query override that I could tap into.

The User Profile page with the custom control and queryoverride looks like this.

The filtering is performed in the FavorableContentList DataSource.  I’m not completely happy with this approach, but it’s very few lines of code and I’m pretty sure it will do the job. Community Server naming conventions have gotten really solid and we’re only tagging Post and Section objects, so looking for "post" will put this issue to bed and enable us to keep the site conversion process moving forward.

This is one of those instances where I’m sure that I am missing some Chameleon trick, as I didn’t think I had to go outside of the system on this one.  Or maybe I did.

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.