The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Is there a mod available that shows which users are reading a topic?
I've seen it on some php forums such as:
I've searched but can't find one
I've seen it on some php forums such as:
2 User(s) are reading this topic
2 members, 0 guests, 0 anonymous users
webbo,Carefree
I've searched but can't find one
Postet den
I think that is available as part of the active users mod, but not 100% certain
Postet den
Not currently a part of Active Users, but that'd be where to start.
Postet den
Hmmm, i thought about it and the most reasonable way to make it would probably be storing each view with the member ID, a timestamp and the topicID in a seperate table. Then do a simple timestamp based query like in my "Most viewed of the past 7 days" thingies. However i think it would produce quite a bit of additional DB traffic and space. YOu'd need to purge the list by timestamp at least once a day for a very active forum unless you plan spending much space on that table.
Sist redigert av
Postet den
Way too much burden that way. I don't know if I'd even implement it, even if limited to a single call when you start reading a topic. I can see a single call upon entering a forum and displaying which members were in there, but nothing further.
Postet den
There is a MOD out there, but it's been ages since I last stumbled across it.
If you were planning on reverse-engineering the MOD, instead of storing the data in the database, you might want to look at using something like application variables or some other similar option (can't think of exactly what, still a little fuzzy after last week's bout with the flu).
If you were planning on reverse-engineering the MOD, instead of storing the data in the database, you might want to look at using something like application variables or some other similar option (can't think of exactly what, still a little fuzzy after last week's bout with the flu).
Postet den
If you still want it at topic level, here's what you do:
Prerequisite: install active users mod
"topic.asp"
Prerequisite: install active users mod
"topic.asp"
Code:
Look for the following lines (appx 739-745):
Response.Write "<table align=""center"" border=""0"" cellPadding=""0"" cellSpacing=""0"" width=""95%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td>" & vbNewLine & _
" <table width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" valign=""top"" width=""50%"">" & vbNewLine
Call PostingOptions()
Above them, insert the following:
strSql = "SELECT AU_LASTPAGE, AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID =" & MemberID
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
strCurrentPage = rs("AU_LASTPAGE")
strQuery = rs("AU_QUERYSTRING")
rs.Close
end if
set rs=Nothing
strSql = "SELECT ME.MEMBER_ID, ME.M_NAME, ME.M_AUHIDE, AU.AU_LASTPAGE, AU.AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS AU, " & strMemberTablePrefix & "MEMBERS ME WHERE ME.M_AUHIDE = '1' AND AU.MEMBER_ID = ME.MEMBER_ID AND AU.AU_LASTPAGE = '" & strCurrentPage & "' AND AU.AU_QUERYSTRING='" & strQuery & "'"
Set rs=my_Conn.Execute(strSql)
if not (rs.BOF or rs.EOF) then
rs.MoveFirst
strName = rs("M_NAME")
Response.Write "<table align=""center"" border=""1"" cellPadding=""3"" cellspacing=""0"" width=""95%"">" & vbNewLine & _
" <tr vAlign=""middle"">" & vbNewLine & _
" <td align=""left"" width=""100%"">" & vbNewLine & _
" <font face="""& strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>Users viewing this topic: "& rs("M_NAME")
Do While NOT rs.EOF
if rs("M_NAME") <> strName then
Response.Write ", " & rs("M_NAME")
end if
rs.MoveNext
Loop
Response.Write " </td></tr></table>" & vbNewLine
End if
Postet den
Excellent Craig [^]
I bet you can't get it to show the 'Guests' count as well reading the topic
I bet you can't get it to show the 'Guests' count as well reading the topic
Postet den
lol - How much? Replace the inserted lines above with these:
Code:
strSql = "SELECT AU_LASTPAGE, AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID =" & MemberID
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
strCurrentPage = rs("AU_LASTPAGE")
strQuery = rs("AU_QUERYSTRING")
rs.Close
end if
set rs=Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS INTG FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID=-1 AND AU_LASTPAGE = '" & strCurrentPage & "' AND AU_QUERYSTRING='" & strQuery & "'"
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
intGuests = rs("INTG")
rs.Close
end if
set rs=Nothing
strSql = "SELECT ME.MEMBER_ID, ME.M_NAME, ME.M_AUHIDE, AU.AU_LASTPAGE, AU.AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS AU, " & strMemberTablePrefix & "MEMBERS ME WHERE ME.M_AUHIDE = '1' AND AU.MEMBER_ID = ME.MEMBER_ID AND AU.AU_LASTPAGE = '" & strCurrentPage & "' AND AU.AU_QUERYSTRING='" & strQuery & "'"
Set rs=my_Conn.Execute(strSql)
if not (rs.BOF or rs.EOF) then
rs.MoveFirst
strName = rs("M_NAME")
Response.Write "<table align=""center"" border=""1"" cellPadding=""3"" cellspacing=""0"" width=""95%"">" & vbNewLine & _
" <tr vAlign=""middle"">" & vbNewLine & _
" <td align=""left"" width=""100%"">" & vbNewLine & _
" <font face="""& strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>Users viewing this topic: "& rs("M_NAME")
Do While NOT rs.EOF
if rs("M_NAME") <> strName then
Response.Write ", " & rs("M_NAME")
end if
rs.MoveNext
Loop
if intGuests > 0 then
Response.Write ", " & intGuests & " guest."
elseif intGuests > 1 then
Response.Write ", " & intGuests & " guests."
end if
Response.Write " </td></tr></table>" & vbNewLine
End if
Sist redigert av
Postet den
$20 to Snitz if you can match IP Boards ....
xyz User(s) are reading this topic
x members, y guests, z anonymous users
xyz User(s) are reading this topic
x members, y guests, z anonymous users
Sist redigert av
Postet den
Originally posted by Webbo
$20 to Snitz if you can match IP Boards ....
xyz User(s) are reading this topic
x members, y guests, z anonymous users![]()
Did you want the quantity of members or their names?
Here's with user names:
Code:
strSql = "SELECT AU_LASTPAGE, AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID =" & MemberID
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
strCurrentPage = rs("AU_LASTPAGE")
strQuery = rs("AU_QUERYSTRING")
rs.Close
end if
set rs=Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS INTA FROM " & strTablePrefix & "ACTIVE_USERS WHERE AU_LASTPAGE = '" & strCurrentPage & "' AND AU_QUERYSTRING='" & strQuery & "'"
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
intViewers = rs("INTA")
rs.Close
end if
set rs=Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS INTG FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID=-1 AND AU_LASTPAGE = '" & strCurrentPage & "' AND AU_QUERYSTRING='" & strQuery & "'"
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
intGuests = rs("INTG")
rs.Close
end if
set rs=Nothing
strSql = "SELECT ME.MEMBER_ID, ME.M_AUHIDE, AU.AU_LASTPAGE, AU.AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS AU, " & strMemberTablePrefix & "MEMBERS ME WHERE ME.M_AUHIDE = '0' AND AU.MEMBER_ID = ME.MEMBER_ID AND AU.AU_LASTPAGE = '" & strCurrentPage & "' AND AU.AU_QUERYSTRING='" & strQuery & "'"
set rs = my_Conn.Execute(strSql)
if not rs.EOF then
rs.MoveFirst
intAnon=0
Do while not rs.EOF
intAnon=intAnon+1
rs.MoveNext
Loop
rs.Close
end if
set rs=Nothing
Response.Write "<table align=""center"" border=""1"" cellPadding=""3"" cellspacing=""0"" width=""95%"">" & vbNewLine & _
" <tr vAlign=""middle"">" & vbNewLine & _
" <td align=""left"" width=""100%"">" & vbNewLine & _
" <font face="""& strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & intViewers & " user(s) viewing this topic: "
strSql = "SELECT ME.MEMBER_ID, ME.M_NAME, ME.M_AUHIDE, AU.AU_LASTPAGE, AU.AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS AU, " & strMemberTablePrefix & "MEMBERS ME WHERE ME.M_AUHIDE = '1' AND AU.MEMBER_ID = ME.MEMBER_ID AND AU.AU_LASTPAGE = '" & strCurrentPage & "' AND AU.AU_QUERYSTRING='" & strQuery & "'"
Set rs=my_Conn.Execute(strSql)
if not (rs.BOF or rs.EOF) then
rs.MoveFirst
Do While NOT rs.EOF
Response.Write rs("M_NAME") & ", "
rs.MoveNext
Loop
End if
Response.Write cInt(intAnon) & " anonymous, " & intGuests & " guest(s)</td></tr></table>" & vbNewLineHere's with just numbers:
Code:
strSql = "SELECT AU_LASTPAGE, AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID =" & MemberID
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
strCurrentPage = rs("AU_LASTPAGE")
strQuery = rs("AU_QUERYSTRING")
rs.Close
end if
set rs=Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS INTA FROM " & strTablePrefix & "ACTIVE_USERS WHERE AU_LASTPAGE = '" & strCurrentPage & "' AND AU_QUERYSTRING='" & strQuery & "'"
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
intViewers = rs("INTA")
rs.Close
end if
set rs=Nothing
strSql = "SELECT COUNT(MEMBER_ID) AS INTG FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID=-1 AND AU_LASTPAGE = '" & strCurrentPage & "' AND AU_QUERYSTRING='" & strQuery & "'"
set rs=my_Conn.Execute(strSql)
if not rs.EOF then
intGuests = rs("INTG")
rs.Close
end if
set rs=Nothing
strSql = "SELECT ME.MEMBER_ID, ME.M_AUHIDE, AU.AU_LASTPAGE, AU.AU_QUERYSTRING FROM " & strTablePrefix & "ACTIVE_USERS AU, " & strMemberTablePrefix & "MEMBERS ME WHERE ME.M_AUHIDE = '0' AND AU.MEMBER_ID = ME.MEMBER_ID AND AU.AU_LASTPAGE = '" & strCurrentPage & "' AND AU.AU_QUERYSTRING='" & strQuery & "'"
set rs = my_Conn.Execute(strSql)
if not rs.EOF then
rs.MoveFirst
intAnon=0
Do while not rs.EOF
intAnon=intAnon+1
rs.MoveNext
Loop
rs.Close
end if
set rs=Nothing
Response.Write "<table align=""center"" border=""1"" cellPadding=""3"" cellspacing=""0"" width=""95%"">" & vbNewLine & _
" <tr vAlign=""middle"">" & vbNewLine & _
" <td align=""left"" width=""100%"">" & vbNewLine & _
" <font face="""& strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & intViewers & " user(s) viewing this topic: "
Response.Write cInt(intAnon) & " anonymous, " & intGuests & " guest(s)</td></tr></table>" & vbNewLine
Sist redigert av
Email Member
Message Member
Post Moderation
Filopplasting
If you're having problems uploading, try choosing a smaller image.
Forhåndsvis post
Send Topic
Loading...