Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Active Users add-on (User Status)
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 6

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 10 March 2003 :  07:07:57  Show Profile
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  Show Profile  Visit MarcelG's Homepage
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
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 10 March 2003 :  11:22:19  Show Profile
Thanks for the mod David, it works great. Now I need to find
some icons to use for status, hmmmm maybe -online -offline.

    _-/Cripto9t\-_
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 10 March 2003 :  11:35:26  Show Profile
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
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 10 March 2003 :  12:06:54  Show Profile
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
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 10 March 2003 :  12:09:56  Show Profile  Visit MarcelG's Homepage
Yepz, works as a charm now! Thanks a bunch!

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

PeeWee.Inc
Senior Member

United Kingdom
1893 Posts

Posted - 10 March 2003 :  12:38:55  Show Profile  Visit PeeWee.Inc's Homepage
I think this should be adde to the AU MOD

De Priofundus Calmo Ad Te Damine
Go to Top of Page

jrountree
Starting Member

20 Posts

Posted - 10 March 2003 :  21:51:54  Show Profile
hey, anyway to get it in every single post? instead of just the thread author?
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 11 March 2003 :  04:30:18  Show Profile  Visit MarcelG's Homepage
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
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 13 March 2003 :  12:06:16  Show Profile  Visit dayve's Homepage
good job David.

Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 14 March 2003 :  16:09:49  Show Profile
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
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 14 March 2003 :  20:45:15  Show Profile
Yeah, never thought of that since I don't use anonymous users..
What determines an anonymous user in the database?

The UK MkIVs Forum
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 14 March 2003 :  22:20:55  Show Profile
David,

It would be M_AUHIDE looking at the activeuser code...

Cheers..

Cheers,

David Greening
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 15 March 2003 :  08:07:02  Show Profile
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
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 15 March 2003 :  15:18:34  Show Profile
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
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 15 March 2003 :  16:14:33  Show Profile
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
Go to Top of Page
Page: of 6 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07