Print Page | Close Window

Active Topics

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=5751
Printed Date: 03 April 2026 at 11:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Active Topics
Posted By: ljamal
Subject: Active Topics
Date Posted: 14 September 2003 at 9:50pm
I'm back to revamping WWF to make it run more efficiently on my site. Made some changes that cut the processing time for the default page in half (from .4-.5 to .2-.23 seconds), part of that was removing the SQL call for the forum configuration (it won't change so why not have it hard coded into the page, one less SQL call).

I'm working on the active topics page and I noticed that the active topics page ignores the permissions table completely and relies soley on the default forum configuration. So if I have a forum viewable only to Moderators on my forum, then the active topics in that area don't show up for those that have access to those topics. Why is this? I hope to be able to write a SQL statement tonight (it's 11:45 pm my time) that will return the correct active topics for a user based upon all the user's permissions. I may post a mod, but my forum is so radically different from this board this point that the mod may not be very useful as I've consolidated cookies and gotten rid or session variables and hacked the code to pieces. :D

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Replies:
Posted By: ljamal
Date Posted: 14 September 2003 at 10:27pm
Well that was easier than I thought.
For those that are interested here's the SQL stored procedure. Note that rather that you have to pass the stored procedure a date and the Author_ID of the user. I'll be figuring out the date ASP side which will allow me to remove all the filters currently in the page. Note I also return all the category information so that I'm not making another call to the database later in order to get the category information.


CREATE PROCEDURE wwf_sp_ActiveTopics (
@AuthorID int,
@dteMinimum datetime
)
as
declare @GroupID int
set @GroupID = (select Group_ID from tblAuthorA where Author_ID=@AuthorID)

SELECT     dbo.tblCategory.Cat_ID AS Cat_ID,dbo.tblCategory.Cat_name AS Cat_name, dbo.tblForum.Forum_name AS Forum_name, dbo.tblForum.Password AS Password,
                          dbo.tblForum.Forum_code AS Forum_code, dbo.tblForum.[Read] AS [Read], dbo.tblTopic.*
FROM        dbo.tblCategory RIGHT OUTER JOIN
                          dbo.tblForum ON dbo.tblCategory.Cat_ID = dbo.tblForum.Cat_ID RIGHT OUTER JOIN
                          dbo.tblTopic ON dbo.tblForum.Forum_ID = dbo.tblTopic.Forum_ID
WHERE
     (tblForum.[Read] = 1 OR      (tblTopic.Forum_ID in (select Forum_ID from tblPermissions where Author_ID=@AuthorID or Group_ID = @GroupID and [Read]=1)))
     AND tblTopic.Last_entry_date >=@dteMinimum
ORDER BY
     tblCategory.Cat_order ASC, tblForum.Forum_Order ASC, tblTopic.Last_entry_date DESC;
GO

Maybe Borg will incorporate this into the active topics page in the next release (if he already hasn't).



-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: wistex
Date Posted: 15 September 2003 at 10:30pm

Thanks!  I was looking for some way to make default.asp load faster.  Mine takes 4 seconds to fully load.  4 seconds is too long, quite frankly.  All the other pages load pretty fast.

What exactly to I have to move into default.asp to make it load faster?

I am using the SQL version.



-------------
http://www.wistex.com" rel="nofollow - WisTex Solutions
http://www.caribbeanchoice.com/forums" rel="nofollow - CaribbeanChoice Forums


Posted By: ljamal
Date Posted: 15 September 2003 at 10:48pm
The biggest time hog for SQL users is the multiple trips to the database. It makes around 20 or so hits to the database, so if you can contract those 20 hits into fewer hits, that will drastically reduce your load speed. This is only something that should be tackled by someone with a fair amount of knowledge of stored procedures and ASP.

For the default page
I moved the common.asp stuff into a stored procedure with gets the user info and permissions and PM info and date formating. I hardcoded all the forum configuration information (because it's not going to change so I don't need the extra call to the database). That cut out about 4-5 calls to the database.
Moving to the page itself, I removed all the stats code from the bottom. I combined the forum and category query into one view of the forums with categories. I returned the permissions for the forum and the user's group and got the moderators and the last posts.
The first paragraph is stuck in one stored procedure and the second in another and they are both queried at one time. Those 2 stored procedures return 9 recordsets which are used to build the page.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: ilnar
Date Posted: 04 October 2003 at 1:58am

Originally posted by ljamal ljamal wrote:

WHERE
     (tblForum.[Read] = 1 OR      (tblTopic.Forum_ID in (select Forum_ID from tblPermissions where Author_ID=@AuthorID or Group_ID = @GroupID and [Read]=1)))
     AND tblTopic.Last_entry_date >=@dteMinimum

Why "tblForum.[Read] = 1" - [Read] in this context not permissions attribute, IMHO.

IMHO, right check "tblForum.[Hide] = 0"



Posted By: fernan82
Date Posted: 04 October 2003 at 3:42am
Originally posted by ilnar ilnar wrote:

Originally posted by ljamal ljamal wrote:

WHERE
     (tblForum.[Read] = 1 OR      (tblTopic.Forum_ID in (select Forum_ID from tblPermissions where Author_ID=@AuthorID or Group_ID = @GroupID and [Read]=1)))
     AND tblTopic.Last_entry_date >=@dteMinimum

Why "tblForum.[Read] = 1" - [Read] in this context not permissions attribute, IMHO.

IMHO, right check "tblForum.[Hide] = 0"

You want to display only the topics the user can read, when tblForum.Hide is set to 1 that only tells the app to hide the forum IF tblForum.[Read] = 0 so that fact that Hide = 1 does not means that the user don't have access to the forum.



-------------
FeRnAN
http://www.danasoft.com/">


Posted By: ljamal
Date Posted: 04 October 2003 at 5:56am
All hide does is hide forums that the user does not have access to.

Forum.[Read] = 1 gets all the forums that the user has default access to.
select Forum_ID from tblPermissions where Author_ID=@AuthorID or Group_ID = @GroupID and [Read]=1 gets all the forums that that the user has special permissions to access.

However, I just noted that if you specifically EXCLUDE a user using the Permissions table, they will still have access to the forum via Active Topics so the additional modifier of AND NOT Forum.TableID in (select Forum_ID from tblPermissions where Author_ID=@AuthorID or Group_ID = @GroupID and [Read]=0) should be added to exclude the forum that the user does not have access to.


-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net