Another thing I noticed about SideBar - it reinits the Globals (already done in ubbthreads.php) and also reautheticates the user - would it be better to make the query directly to avoid the overhead of doing an authentication?
(I noticed that first visit I get a cookie error - on the session cookie - because SideBars cannot create cookies at that time.)