Dave Burke : Freelance .NET Web Developer specializing in Online Communities

A Pesky CS2007 Forums Moderation Bug

My worse fears have been realized.  I've become Bill Bosacker.  Hee! Hee!  Actually, if I were Bill I probably wouldn't have gotten beaten-up so badly tracking down this sucker today.

Here's the deal.  You set a CS2007 forum as moderated.  Go ahead, I'll wait.  Submit and approve a post (or a hundred) as you normally would and you will never see them on a forums post list.  Honest.  If I'm right and this is the case then it's pretty wild that no one discovered this on their CS2007 sites yet.  Or maybe they did and I missed it.  Or maybe its just me and bad kharma for being such a NNTP Forum Fanatic.

The issue causing the problem is that the postlevel gets changed from a "1" when the post is entered to a "2" after it's approved.  Below is a cs_posts table excerpt.

 


When the postlevel becomes a "2" on approval it won't no way no how appear on the forum postlist like the one shown below.

 


Once I realized what was happening it was pretty easy to track down the problem, finding it in the SQL stored proc cs_system_UpdateThread which is called from cs_Moderate_ApprovePost.  Near the end of cs_system_UpdateThread we have

 

UPDATE
cs_Posts
SET
PostLevel = 2,
SortOrder = SortOrder + 1
WHERE
ThreadID = @ThreadID
AND PostID >= @ReplyPostID and SettingsID = @SettingsID


It's amazing what one little misplaced equal sign can do.  I don't know how this got into CS2007, but it wasn't in previous versions of cs_system_UpdateThread.  Change to "PostID > @ReplyPostID" and you'll see your approved posts again. 

Comments (4) | Post RSS RSS comment feed

Posted on 5/3/2007 7:33:25 PM by Dave Burke
Categories: Community Server
Tags:

Related posts

Comments (4) -

5/3/2007 10:30:34 PM Permalink

Funny, but we just found this one yesterday as well. We've already discussed the fix which will make sure we properly set postLevel for all posts in the thread (as this will still push all posts to level 2).

For the record, the "=" was added to alleviate the merging of two threads causing two threads to appear and point to a single thread. Ultimately, some of this SQL is old and we should have just fixed the issue correctly the first time. Smile

José Lema |

5/3/2007 10:52:43 PM Permalink

Thanks, José.  That's great insider information.  I figured somebody had to notice this postlevel picadillo.  Reverting back to > only seemed to do the trick.  I'll keep your advice in mind if I need to do any merging.

daveburke |

5/4/2007 12:26:26 AM Permalink

Grasshopper learns quickly.

Bill Bosacker |

5/4/2007 5:27:22 AM Permalink

Hey, Bill!  Well someone's got to channel you to do this stuff now that you're moving into high finance.

daveburke |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke