Author |
Topic |
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 March 2003 : 07:07:57
|
Following on from http://forum.snitz.com/forum/topic.asp?TOPIC_ID=42409
This is what I came up with to enable the viewing of whether a member is online/offline on topic.asp, it will appear under the post count.
Requires Active Users 4 mod
Put the following code in inc_func_common.asp underneath the AUHandleLoging() function
function AUGetOnlineMembers()
strSql ="SELECT " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID "
strSql = strSql & " FROM " & strTablePrefix & "ACTIVE_USERS "
set rsOnline = my_Conn.Execute(strSql)
AUGetOnlineMembers = rsOnline.GetRows()
rsOnline.close
set rsOnline = nothing
end function
function AUMemberStatus(OnlineMembers, CurrentMember)
for intRow = 0 to UBound(OnlineMembers, 2)
if OnlineMembers(0,intRow) = CurrentMember then
AUMemberStatus = "online"
exit function
end if
next
AUMemberStatus = "offline"
end function
NOTE: The functions above do not work with "Anonymous Users", scrolldown for the updated functions. I'll leave these on for users that have already implemented it.
at the top of topic.asp, just before the forum sql begins (approx line 105)
'## Get online users into an array
arrOnlineMembers = AUGetOnlineMembers()
'## end
in topic.asp in the GetFirst function (approx line 1030) replace
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Member_Posts & " Posts</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & strForumFirstCellColor & """ width=""" & strTopicWidthRight & """" with
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Member_Posts & " Posts</small></font><br />" & vbNewLine & _
" <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>Status: "& AUMemberStatus(arrOnlineMembers, TMember_ID) &"</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & strForumFirstCellColor & """ width=""" & strTopicWidthRight & """"
also approx line 774 replace
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Reply_MemberPosts & " Posts</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & CColor & """ height=""100%"" width=""" & strTopicWidthRight & """" with
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Reply_MemberPosts & " Posts</small></font><br />" & vbNewLine & _
" <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>Status: "& AUMemberStatus(arrOnlineMembers, Reply_MemberID) &"</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & CColor & """ height=""100%"" width=""" & strTopicWidthRight & """"
I chose to use functions so that it could also be used on other pages such as Private Messages.
|
The UK MkIVs Forum |
Edited by - DavidRhodes on 15 March 2003 08:14:43 |
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 March 2003 : 08:28:10
|
David,
Excellent initiative, but I've tried it and everyone is showed as being 'offline', even though they are shown in the Active Users panel as being online...Even myself, when viewing the topic. I use NT accounts, so maybe that's causing this...? I cannot see where the value for CurrentMember is being defined, so maybe there's the problem.
How can I check that I am using the correct version of Active Users ? That could just as well be causing this.. |
portfolio - linkshrinker - oxle - twitter |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 10 March 2003 : 11:22:19
|
Thanks for the mod David, it works great. Now I need to find some icons to use for status, hmmmm maybe -online -offline.
|
_-/Cripto9t\-_ |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 March 2003 : 11:35:26
|
Oops, doesn't quite work, i've got something wrong in the AUMemberStatus, it works with one user logged in but not more than one The CurrentMember is a parameter of the AUMemberStatus so it's defined when you call the function |
The UK MkIVs Forum |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 March 2003 : 12:06:54
|
It works now, i've updated the code above Only the AUMemberStatus function has changed for those you have already implemented it |
The UK MkIVs Forum |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
PeeWee.Inc
Senior Member
United Kingdom
1893 Posts |
Posted - 10 March 2003 : 12:38:55
|
I think this should be adde to the AU MOD |
De Priofundus Calmo Ad Te Damine |
|
|
jrountree
Starting Member
20 Posts |
Posted - 10 March 2003 : 21:51:54
|
hey, anyway to get it in every single post? instead of just the thread author? |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 11 March 2003 : 04:30:18
|
jrountree, if you follow the exact instruction, it should be shown in every single post. See the part below:
quote:
in topic.asp also replace approx line 774
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Reply_MemberPosts & " Posts</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & CColor & """ height=""100%"" width=""" & strTopicWidthRight & """"
with
Response.Write " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>" & Reply_MemberPosts & " Posts</small></font><br />" & vbNewLine & _
" <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><small>Status: "& AUMemberStatus(arrOnlineMembers, Reply_MemberID) &"</small></font></p></td>" & vbNewLine & _
" <td bgcolor=""" & CColor & """ height=""100%"" width=""" & strTopicWidthRight & """"
|
portfolio - linkshrinker - oxle - twitter |
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 13 March 2003 : 12:06:16
|
good job David. |
|
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 14 March 2003 : 16:09:49
|
David,
Great job, just a small issue with anonymous users, they still show up as online even though they are meant to be "invisable". Should they not come up as offline? Apart from that, real simple to install...
|
Cheers, David Greening |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 14 March 2003 : 20:45:15
|
Yeah, never thought of that since I don't use anonymous users.. What determines an anonymous user in the database? |
The UK MkIVs Forum |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 14 March 2003 : 22:20:55
|
David,
It would be M_AUHIDE looking at the activeuser code...
Cheers.. |
Cheers, David Greening |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 15 March 2003 : 08:07:02
|
Try this
Replace both functions in inc_func_common.asp with the code below for anonymouse members to work.
function AUGetOnlineMembers()
strSql ="SELECT " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID "
strSql = strSql & " FROM " & strTablePrefix & "ACTIVE_USERS "
if strAUAnon and not(bolOverride) then
strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS ON "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID "
strSql = strSql & "AND " & strTablePrefix & "MEMBERS.M_AUHIDE <> 0"
end if
set rsOnline = my_Conn.Execute(strSql)
If NOT rsOnline.EOF Then AUGetOnlineMembers = rsOnline.GetRows()
rsOnline.close
set rsOnline = nothing
end function
function AUMemberStatus(OnlineMembers, CurrentMember)
if IsArray(OnlineMembers) then
for intRow = 0 to UBound(OnlineMembers, 2)
if OnlineMembers(0,intRow) = CurrentMember then
AUMemberStatus = "online"
exit function
end if
next
end if
AUMemberStatus = "offline"
end function
|
The UK MkIVs Forum |
Edited by - DavidRhodes on 15 March 2003 08:08:34 |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 15 March 2003 : 15:18:34
|
David,
I get the following:
Microsoft JET Database Engine error '80040e14'
Join expression not supported.
/Forums/inc_func_common.asp, line 182 which is this code:
if strAUAnon and not(bolOverride) then strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS ON " strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID " strSql = strSql & "AND " & strTablePrefix & "MEMBERS.M_AUHIDE <> 0" end if set rsOnline = my_Conn.Execute(strSql) <---- Line 182
Do you have any ideas?
|
Cheers, David Greening |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 15 March 2003 : 16:14:33
|
sorry, the above is SQL Server, try this for access
function AUGetOnlineMembers()
strSql ="SELECT " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID "
strSql = strSql & " FROM " & strTablePrefix & "ACTIVE_USERS "
if strAUAnon and not(bolOverride) then
strSql = strSql & ", " & strTablePrefix & "MEMBERS WHERE "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "ACTIVE_USERS.MEMBER_ID "
strSql = strSql & "AND " & strTablePrefix & "MEMBERS.M_AUHIDE <> 0"
end if
set rsOnline = my_Conn.Execute(strSql)
If NOT rsOnline.EOF Then AUGetOnlineMembers = rsOnline.GetRows()
rsOnline.close
set rsOnline = nothing
end function
|
The UK MkIVs Forum |
|
|
Topic |
|