Author |
Topic  |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 29 November 2000 : 19:13:54
|
Changes to code for generic Hidden Forums.
This allows you to make any forum type hidden.
<font color=green><b>Database Change</b></font id=green>
You will need to add a new field to <font color=blue>FORUM_FORUM</font id=blue> called <font color=blue>F_HIDDEN, Type smallint</font id=blue>, with a default value of <font color=blue>1</font id=blue>
<font color=green><b>Code Changes</b></font id=green>
Three files require editing
<font color=blue><b>inc_functions.asp</b></font id=blue> look for the <font color=blue>function chkDisplayForum(fForum_ID)</font id=blue> In the select statement, change the code between <font color=blue>case 0,1,2....</font id=blue> and <font color=blue>case 5 </font id=blue> to <pre id=code><font face=courier size=2 id=code><font color=red> if rsAccess("F_HIDDEN") = 1 then chkDisplayForum = false else chkDisplayForum= true end if exit function</font id=red> </font id=code></pre id=code>
<font color=blue><b>post.asp</b></font id=blue> <b>1.</b> search for<pre id=code><font face=courier size=2 id=code><font color=blue>if strRqMethod = "EditForum" or _ strRqMethod = "EditURL" then '## Forum_SQL</font id=blue></font id=code></pre id=code>add <font color=red><b>& "," strTablePrefix & "FORUM.F_HIDDEN "</b></font id=red> to the end of the line starting <font color=blue>strSql = "SELECT "</font id=blue>
<b>2.</b> search for <font color=blue>SELECT readonly name="AuthType"></font id=blue>, scroll down untill you find the corresponding <font color=blue></select</font id=blue>. Directly beneath this, add <pre id=code><font face=courier size=2 id=code><font color=red> <input type="checkbox" name="HideForum" value="1" <% if ForumHide = 1 then Response.Write(" checked") %>>Hidden </font id=red></font id=code></pre id=code>
<font color=blue><b>post_info.asp</b></font id=blue> <b>1.</b> search for <font color=blue>strSql = "INSERT INTO " & strTablePrefix & "FORUM "</font id=blue> scroll down a couple of lines until you find <font color=blue>if strPrivateForums = "1" then</font id=blue>, add <font color=red>strSql = strSql & ", F_HIDDEN"</font id=red> imediately before the corresponding <font color=blue>end if</font id=blue> Scroll down a few more lines and you will find another <font color=blue>if strPrivateForums = "1" then</font id=blue> imediately above its <font color=blue>end if</font id=blue>, insert <font color=red>strSql = strSql & ", " & Request.Form("HideForum") & ""</font id=red>. Repeat the above steps once more, there are two occurences of <font color=blue>strSql = "INSERT INTO " & strTablePrefix & "FORUM "</font id=blue>
<b>2.</b> Now do a search for <font color=blue>strSql = "UPDATE " & strTablePrefix & "FORUM "</font id=blue>, it will occur in two places, once again, scroll down a few lines until you find the <font color=blue>if strPrivateForums = "1" then</font id=blue>, imediately above it's <font color=blue>end if</font id=blue>, insert <font color=red>strSql = strSql & ", F_HIDDEN = " & Request.Form("HideForum") & ""</font id=red> repeat the same steps for both updates.
Any probs, just ask.
<font color=blue>'Resistance is futile'</font id=blue>
if you need a setup script for the db, you can download one here
Edited by - huwr on 29 November 2000 19:50:55 |
|
HuwR
Forum Admin
    
United Kingdom
20587 Posts |
Posted - 29 November 2000 : 20:23:57
|
Ooops, minor change to above code, changes in orange
<font color=blue><b>post_info.asp</b></font id=blue> <b>1.</b> search for <font color=blue>strSql = "INSERT INTO " & strTablePrefix & "FORUM "</font id=blue> scroll down a couple of lines until you find <font color=blue>if strPrivateForums = "1" then</font id=blue>, add <font color=red>strSql = strSql & ", F_HIDDEN"</font id=red> imediately before the corresponding <font color=blue>end if</font id=blue> Scroll down a few more lines and you will find another <font color=blue>if strPrivateForums = "1" then</font id=blue> imediately above its <font color=blue>end if</font id=blue>, insert <font color=orange> if Request.Form("HideForum") = 1 then strSql = strSql & ", 1 " else strSql = strSql & ", 0 " end if </font id=orange>. Repeat the above steps once more, there are two occurences of <font color=blue>strSql = "INSERT INTO " & strTablePrefix & "FORUM "</font id=blue>
<b>2.</b> Now do a search for <font color=blue>strSql = "UPDATE " & strTablePrefix & "FORUM "</font id=blue>, it will occur in two places, once again, scroll down a few lines until you find the <font color=blue>if strPrivateForums = "1" then</font id=blue>, imediately above it's <font color=blue>end if</font id=blue>, insert <font color=orange> if Request.Form("HideForum") = 1 then strSql = strSql & ", F_HIDDEN = 1 " else strSql = strSql & ", F_HIDDEN = 0 " end if </font id=orange> repeat the same steps for both updates.
Any probs, just ask.
<font color=blue>'Resistance is futile'</font id=blue>
Edited by - huwr on 29 November 2000 20:29:16 |
 |
|
ASPTools
New Member

USA
89 Posts |
Posted - 01 December 2000 : 22:31:26
|
I found one problem in the code and here is the fix. In the code that you insert into the inc_functions.asp you have it look up a database field that is not in the SQL Query above it. So all you do is:
Search for this line of code :
<font color=blue>strSql = "SELECT " & strTablePrefix & "FORUM.F_USERLIST, " & strTablePrefix & "FORUM.F_PRIVATEFORUMS "</font id=blue>
And replace the whole line with this :
<font color=red>strSql = "SELECT " & strTablePrefix & "FORUM.F_USERLIST, " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " & strTablePrefix & "FORUM.F_HIDDEN "</font id=red>
Thats it.
Matt Lehner
<center><font color=green>-=<font color=red>*</font id=red>=--=<font color=red>*</font id=red>=--=<font color=red>*</font id=red>=-</font id=green> Please help me not to be so busy making a living, That I forget to make a life, AMEN <font color=green>-=<font color=red>*</font id=red>=--=<font color=red>*</font id=red>=--=<font color=red>*</font id=red>=-</font id=green></center> |
 |
|
|
Topic  |
|
|
|