Print Page | Close Window

Last 10 Post

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=20314
Printed Date: 29 March 2026 at 4:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Last 10 Post
Posted By: gölge
Subject: Last 10 Post
Date Posted: 14 June 2006 at 8:36pm
for not shown hidden posts add this code after WHERE at sql connection code :
 
Where tblTopic.Hide = 0 And bla bla bla....



Replies:
Posted By: mbd2
Date Posted: 14 June 2006 at 9:07pm
Thanks Golge for the tip,  but I need to hide it now so only moderators  and admin can see posting.  Any ideas. Wink
 
Dale
 
 
<%
'#########################################################################
'##
'## Display Newest Forum Posts with WebWizForums v8.x
'## Modified by Dale (mbd2) to work with v8.x
'## ogrinally designed by http://www.maddog-asp.com - www.maddog-asp.com
'##
'## Just change the database connection in the strMembersModCon
'## variable.
'##
'## Then make sure the strLastestPostsModForumPath is the right path
'## to your forum.
'##
'## Mod from http://www.maddogs-asp.com - www.maddogs-asp.com
'## 
'## Writen by Drew Gauderman (aka MadDog)
'##
'#########################################################################
%>
<style type="text/css">
<!--
.text {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12; color: black;}
a {font-family: Verdana, Arial, Helvetica, sans-serif, Verdana, Arial, Helvetica, sans-serif; color: blue; font-size: 12; text-decoration: none;}
a:hover {font-family: Verdana, Arial, Helvetica, sans-serif; color: blue; font-size: 12; text-decoration: underline;}
a:visited {font-family: Verdana, Arial, Helvetica, sans-serif; color: blue; font-size: 12; text-decoration: none;}
a:visited:hover {font-family: Verdana, Arial, Helvetica, sans-serif; color: blue; font-size: 12; text-decoration: underline;}
-->
</STYLE>
<table cellpadding="3" cellspacing="1" width="186" bgcolor="" border="0" class="text">
  <tr>
    <td bgcolor="" align="center" class="tableSubLedger" height="15">10
      Newest Posts</td>
 </tr>
 <tr>
    <td width="33%" align="center" class="tableRow" nowrap height="25">
      <%
Dim rsLastestPostsMod
Dim adoLastestPostsModCon
Dim strLastestPostsModCon
Dim strSQLLastsPostsMod
Dim strLastestPostsModTopicSubject
Dim strLastestPostsModForumPath
Dim intLastestPostsTotal

'The path to the forum
strLastestPostsModForumPath = " "

'How many new topics to show
intLastestPostsTotal = 10

'Database connection
'-----------------------------
'-----------------------------

'Default connection
strLastestPostsModCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("")

'Uncomment for a full phsyical path. Then change the path
'strLastestPostsModCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="

'Uncomment for a DSN connection
'strLastestPostsModCon = "DSN=DSN_NAME"

'-----------------------------
'-----------------------------

Set adoLastestPostsModCon = Server.CreateObject("ADODB.Connection")
adoLastestPostsModCon.Open strLastestPostsModCon

Set rsLastestPostsMod = Server.CreateObject("ADODB.Recordset")

strSQLLastsPostsMod = "SELECT Top " & intLastestPostsTotal & " tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & "Where tblTopic.Hide = 0 And ((tblForum.Password) Is Null) "
strSQLLastsPostsMod = strSQLLastsPostsMod & "ORDER BY tblTopic.Last_entry_date DESC;"

rsLastestPostsMod.Open strSQLLastsPostsMod, adoLastestPostsModCon

If rsLastestPostsMod.EOF Then
 Response.Write "<span class=""smltext"">No Forum Posts Made</span>"
Else
 Do while NOT rsLastestPostsMod.EOF
  If len(rsLastestPostsMod("Subject")) > 18 then
   strLastestPostsModTopicSubject = left(rsLastestPostsMod("Subject"),18) & "...&nbsp;"
  Else
   strLastestPostsModTopicSubject = rsLastestPostsMod("Subject")
  End If

  Response.Write("<a href=""" & strLastestPostsModForumPath & "forum_posts.asp?TID=" & rsLastestPostsMod("Topic_ID") & "&PN=1"">" & strLastestPostsModTopicSubject & "</a>")

 rsLastestPostsMod.MoveNext
 If NOT rsLastestPostsMod.EOF Then Response.Write("<br>")
 Loop
End If

'Reset Server Objects
rsLastestPostsMod.Close
Set rsLastestPostsMod = Nothing
adoLastestPostsModCon.Close
Set adoLastestPostsModCon = Nothing
%>
    </td>
 </tr>
</table>



-------------
Balloon Entertainment at it's best! http://www.mbd2.com" rel="nofollow - www.mbd2.com -- http://www.mbd2.com/tradeshow/promodvd.html" rel="nofollow - Trade Show Presenter - video


Posted By: Scotty32
Date Posted: 14 June 2006 at 11:03pm
change
strSQLLastsPostsMod = "SELECT Top " & intLastestPostsTotal & " tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & "Where tblTopic.Hide = 0 And ((tblForum.Password) Is Null) "
strSQLLastsPostsMod = strSQLLastsPostsMod & "ORDER BY tblTopic.Last_entry_date DESC;"



to

strSQLLastsPostsMod = "SELECT Top " & intLastestPostsTotal & " tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQLLastsPostsMod = strSQLLastsPostsMod & " WHERE tblForum.Password Is Null "
if not blnAdmin and not blnModerator then
strSQLLastsPostsMod = strSQLLastsPostsMod & "and tblTopic.Hide = 0 "
end if

strSQLLastsPostsMod = strSQLLastsPostsMod & "ORDER BY tblTopic.Last_entry_date DESC;"



the red part is what i changed


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: mbd2
Date Posted: 15 June 2006 at 3:00pm
Scotty_32
 
I've tried you solution and it doesn't work.  Users can still see posts that they should not (test and test2).  If they click on the title it tell them they don't have access, but they can still view the topic name.  Anybody else have any ideas?
 
Test link http://www.mbd2.com/forum/new_posts2_test.asp - http://www.mbd2.com/forum/new_posts2_test.asp
 
Dale
 
 


-------------
Balloon Entertainment at it's best! http://www.mbd2.com" rel="nofollow - www.mbd2.com -- http://www.mbd2.com/tradeshow/promodvd.html" rel="nofollow - Trade Show Presenter - video


Posted By: gölge
Date Posted: 15 June 2006 at 3:41pm
it must be:
 
if intgroupid <>1 and intgroupid <>3 then
strSQLLastsPostsMod = strSQLLastsPostsMod & "and tblTopic.Hide = 0 "
end if
 
3 is moderator id. write your own moderator id for that...


Posted By: mbd2
Date Posted: 15 June 2006 at 4:25pm
Nope, didn't work either.  This one has me really stumped.  I sure its an oversight, something staring us right in the face.


-------------
Balloon Entertainment at it's best! http://www.mbd2.com" rel="nofollow - www.mbd2.com -- http://www.mbd2.com/tradeshow/promodvd.html" rel="nofollow - Trade Show Presenter - video


Posted By: Scotty32
Date Posted: 15 June 2006 at 6:46pm
well my solution was so members dont see PENDING APPROVAL posts

i think maddog released his Last 10 posts for version 8 you can check that out
as that i beleive only shows posts users have permissions for, eg if you have a forum that only certain groups/members can enter

as the code above doesnt do this, it only hides topics that are in forums with passwords and topics that need approval by a moderator


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: benp
Date Posted: 22 June 2006 at 12:17pm
Has anyone tried this with MYSQL? I'm getting an error!!


Posted By: scotts
Date Posted: 20 July 2006 at 9:49pm
I am having a bit of trouble on this too.  Maddog was very helpful, but I know I was bugging him to death on this script.  If anyone has a suggestion I would be thankful.
 
This is for WWF v8.  I was able to get the script to connect to the database but it appears to not see the new posts (or any).  From the forum I have added topics and replied to them but nothing shows.
 
Here is the hyperlink:
http://www.clubtec.com/secure-new/secure-sub-pages/ctd-sidebar/ctd-new_posts8.asp - http://www.clubtec.com/secure-new/secure-sub-pages/ctd-sidebar/ctd-new_posts8.asp
 
 
Here is my code.  I think the problem is in how the record set is formed but I just cannot see it.
=====================================
=====================================
<style type="text/css">
<!--
.text {font-family: Tahoma; font-size: 11; color: white;}
a {font-family: Tahoma; color: white; font-size: 11; text-decoration: none;}
a:hover {font-family: Tahoma; color: white; font-size: 11; text-decoration: underline;}
a:visited {font-family: Tahoma; color: white; font-size: 11; text-decoration: none;}
a:visited:hover {font-family: Tahoma; color: white; font-size: 11; text-decoration: underline;}
-->
</STYLE>
<body bgcolor="#1C6582">
<table cellpadding="3" cellspacing="1" width="150" class="text">
 <tr>
  <td align="center" height="15">
 <p align="left">
 <a href="../../_forum8/forum/default.asp">
 <img border="0" src="../../../images/ctd-recentposts.jpg" width="150" height="18"></a></td>
 </tr>
 <tr>
  <td height="25">
<%
'#########################################################################
'##
'## Display Newest Forum Posts with WebWizForums v8.x
'##
'## Just configure the database settings and it will read the latest forum
'## posts. This file should be setup for your website.
'##
'## Mod from http://www.iportalx.net - www.iportalx.net
'##
'## Writen by Drew Gauderman (aka MadDog)
'## Email: mailto:drew@aspinvision.com - drew@aspinvision.com
'## Website: http://www.iportalx.net - www.iportalx.net
'##
'## Dont want to do this yourself? Get iPortalX! A Portal with WebWizForum!
'## http://www.iportalx.net - http://www.iportalx.net
'##
'#########################################################################
Dim rsCommon
Dim adoCon
Dim strCon
Dim strSQL
Dim strLastestPostsModTopicSubject
Dim strLastestPostsModForumPath
Dim intLastestPostsTotal
Dim strDatabaseType
Dim strDBTrue
Dim strDBFalse
Dim strFrameTarget
'The path to the forum
strForumPath = "../../../secure-new/_forum8/forum/"
'How many new topics to show
intLastestPostsTotal = 6
'//-----------------------------------------------------
'// Database connection and settings
'//-----------------------------------------------------
'Database settings for Access
strDatabaseType = "Access"
strDBTrue = "True"
strDBFalse = "False"
'Database settings for MSSQL
strDatabaseType = "SQLServer"
strDBTrue = "1"
strDBFalse = "0"
'Database settings for MySQL
'strDatabaseType = "MySQL"
'strDBFalse = 0
'strDBTrue = -1
'Access connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../../../fpdb/ww8F0rum$.mdb")  'This one is for Access 2000/2002

'MSSQL Connection
'Const strSQLServerName = ".\SQLExpress" 'Holds the name of the SQL Server (This is the name/location or IP address of the SQL Server)
'Const strSQLDBUserName = "sa" 'Holds the user name (for SQL Server Authentication)
'Const strSQLDBPassword = "blank" 'Holds the password (for SQL Server Authentication)
'Const strSQLDBName = "beta2"
'strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
'//-----------------------------------------------------
'Start the database connection
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open strCon
'Start a recordset connection
Set rsCommon = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT "
If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then strSQL = strSQL & " TOP " & intLastestPostsTotal & " "
strSQL = strSQL & "tblForum.Forum_name, tblTopic.Topic_ID, tblTopic.Subject, tblThread.Thread_ID, tblThread.Message_date, tblAuthor.Author_ID, tblAuthor.Username, tblThread.Message  " & _
    "FROM tblForum, tblTopic, tblAuthor, tblThread, tblPermissions " & _
    "WHERE tblForum.Forum_ID = tblTopic.Forum_ID " & _
        "AND tblTopic.Topic_ID = tblThread.Topic_ID " & _
        "AND tblAuthor.Author_ID = tblThread.Author_ID " & _
        "AND tblForum.Forum_ID = tblPermissions.Forum_ID " & _
        "AND (tblPermissions.Group_ID = 2 AND tblPermissions.View_Forum = " & strDBTrue & ") "
strSQL = strSQL & "AND (tblForum.Password = '' OR tblForum.Password Is Null) AND (tblTopic.Hide = " & strDBFalse & " AND tblThread.Hide = " & strDBFalse & ") ORDER BY tblThread.Message_date DESC "
'mySQL limit operator
If strDatabaseType = "mySQL" Then strSQL = strSQL & " LIMIT " & intLastestPostsTotal
strSQL = strSQL & ";"
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then saryForumPosts = rsCommon.getRows()
'Close all connections, very important!!
rsCommon.Close
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
 
'No forum posts
If IsArray(saryForumPosts) = False Then
    Response.Write "<span class=""text_arial"">No Forum Posts Made</span>"
'Forum posts have been made
Else
    'Loop through the array of forum posts
    For intLoopCounter = 0 TO UBound(saryForumPosts, 2)
        'saryForumPosts array lookup table
        '0 = tblForum.Forum_name
        '1 = tblTopic.Topic_ID
        '2 = tblTopic.Subject
        '3 = tblThread.Thread_ID
        '4 = tblThread.Message_date
        '5 = tblAuthor.Author_ID
        '6 = tblAuthor.Username
        '7 = tblThread.Message
        strLastestPostsModTopicSubject = saryForumPosts(2, intLoopCounter)
        'Crop the subject down to 18 characters
        If Len(strLastestPostsModTopicSubject) > 18 then strLastestPostsModTopicSubject = Left(strLastestPostsModTopicSubject,30) & "..."
        Response.Write("<a target=strFrameTarget & href=""" & strForumP



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