Active Users - Active Members Record? - Posted (2154 Views)
Senior Member
MarkJH
Posts: 1722
1722
I was wondering if it was possible to change the way Active Users works so that it displays the record Active Members as well as record Active Users.
Something like this:

Active Members: 10 | Guests: 54 | Total: 64
Active Members Record: 25 | Record Set On: 14 Dec 2004 at 15:09:22
Active Users Record: 189 | Record Set On: 19 Dec 2004 at 22:54:48

How could it be done?<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Senior Member
masterao
Posts: 1678
1678
That would require two additional fields in the new_config table, one for storing the record and one for storing the date. You would also need two new application variables to display the Active Member record and the date it was set on. Finally you need a new function to check if a new record is set. You should be able to create the new function by using the function which checks for a new record of Active Users (function chkAURecord).<
Posted
Senior Member
MarkJH
Posts: 1722
1722
Not as easy as I'd hoped, then!<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Posted
Senior Member
masterao
Posts: 1678
1678
If I had some free time I would do it for you, but unfortunately I don't have that at the moment.
Im not aware of how comfortable you are with coding, but it shouldn't be that difficult. Creating the new function can be daunting, but if you use the current function which checks for record active users as basis, it should be doable.<
Posted
Senior Member
MarkJH
Posts: 1722
1722
I'm a cut-and-paste coder at best, Jan. I see what you are saying and I think I see how it can be done... without too much ASP knowledge. If I can set aside some time, I'll see if I can create the MOD. Would make a nice addition to the AU MOD, IMHO.
To be honest, I think I'm more scared about messing up the tables!<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Posted
Senior Member
masterao
Posts: 1678
1678
Just remember to backup the files and add one piece of code at a time. That way you can see if a table gets out of its borders.
If you get stuck and need help, post here and I will help you.<
Posted
Senior Member
MarkJH
Posts: 1722
1722
Actually, I was referring to the new_config table in the database. smile<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Posted
Senior Member
masterao
Posts: 1678
1678
Oh, ok smile.
Adding those isn't too difficult, as you can use the alternative mod setup. The code needed would be something like this:

[INSERT] CONFIG_NEW
(C_VARIABLE,C_VALUE)#('intAUMeRecord','0')
(C_VARIABLE,C_VALUE)#('strAUMeRecordDate','11111111111111')
[END]
That assumes that you name the new variables intAUMeRecord and strAUMeRecordDate.<
Posted
Senior Member
MarkJH
Posts: 1722
1722
Okay, I've got so far but I've hit a wall.
I've created a new function in inc_func_common called chkAUMeRecord:

Code:
function chkAUMeRecord(intTotalActiveMembers)
if cInt(intTotalActiveMembers) > cInt(intAUMeRecord) then 'We have a new record!!! :)
'Check to see if it *Really* is a record, or if Application varaibles just got reset
strSql = "SELECT C_VALUE FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE = 'intAUMeRecord'"
set rs = my_conn.execute (strSql)
intOldMeRecord = cint(rs("C_VALUE"))
rs.close
set rs = nothing
if cInt(intOldMeRecord) > cInt(intTotalActiveMembers) then
'Oopsi, this was a false alarm
strSql = "SELECT C_VALUE FROM " & strTablePrefix & "CONFIG_NEW WHERE C_VARIABLE = 'strAUMeRecordDate'"
set rs = my_conn.execute (strSql)
strOldMeDate = rs("C_VALUE")
rs.close
set rs = nothing
Application(strCookieURL & "INTAUMERECORD") = intOldMeRecord
Application(strCookieURL & "STRAUMERECORDDATE") = strOldMeDate
intAUMeRecord = intOldMeRecord
strAUMeRecordDate = strOldMeDate
else
my_conn.execute ("UPDATE " & strTablePrefix & "CONFIG_NEW SET C_VALUE = '" & cstr(intTotalActiveMembers) & "' WHERE C_VARIABLE = 'intAUMeRecord'")
my_conn.execute ("UPDATE " & strTablePrefix & "CONFIG_NEW SET C_VALUE = '" &DateToStr(strForumTimeAdjust) & "' WHERE C_VARIABLE = 'strAUMeRecordDate'")
intAUMeRecord = intTotalActiveMembers
strAUMeRecordDate = DateToStr(strForumTimeAdjust)
Application(strCookieURL & "INTAUMERECORD") = intTotalActiveMembers
Application(strCookieURL & "STRAUMERECORDDATE") = DateToStr(strForumTimeAdjust)
end if
end if
end function

In inc_activeusers I've created a new variable called intTotalActiveMembers which is basically intTotalActiveUsers without adding the guests. Therefore, I've changed the code thus:

Code:
'## Ls3k - Now lets count those peskey guests.
strSql = "SELECT COUNT(AU_IP) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID = -1"
set rs = my_conn.execute (strSql)
intActiveGuests = rs("CNT")
rs.close
set rs = nothing
intTotalActiveMembers = intTotalActiveUsers intTotalActiveUsers = intTotalActiveUsers + intActiveGuests

I've added the call to the function to check the record:

Code:
'## Ls3k - Ok, now it is time to check the record, cause it would be cool if we broke it!
chkAUMeRecord(intTotalActiveMembers)
chkAURecord(intTotalActiveUsers)

I've added a new line of code to the stats which displays the new active members record like this:

Code:
    if (strAUAdminColor <> "" or strAUModColor <> "") AND intActiveMembers > 0 then
response.write "       [ <font color=""" & strAUAdminColor & """>" & fLang(strLangMOD_Ls3kAU_00050) & "</font> | <font color=""" & strAUModColor & """>" & fLang(strLangMOD_Ls3kAU_00060) & "</font> ]" & VBNewLine
end if
response.write " <br>" & VBNewLine & _
" " & fLang(strLangMOD_Ls3kAU_00120) & ": " & intAUMeRecord & " | " & fLang(strLangMOD_Ls3kAU_00080) & ": " & ChkDate(strAUMeRecordDate," " & fLang(strLangMOD_Ls3kAU_00090) & " ",true) & VBNewLine & _
" <br>" & VBNewLine & _
" " & fLang(strLangMOD_Ls3kAU_00070) & ": " & intAURecord & " | " & fLang(strLangMOD_Ls3kAU_00080) & ": " & ChkDate(strAURecordDate," " & fLang(strLangMOD_Ls3kAU_00090) & " ",true) & VBNewLine & _
" </td>" & VBNewLine & _
" </tr>" & VBNewLine & _
" <tr>" & VBNewLine & _
" <td class=""forumheader"" colspan=""" & sGetColspan(6,5) & """>" & VBNewLine & _
" " & fLang(strLangMOD_Ls3kAU_00100) & ": "

(strLangMOD_Ls3kAU_00120 = "Active Members Record: ")

I've added the new variables to the CONFIG_NEW table in the database using the alternative mod setup as you suggested, and checking the database, they are being populated with the members record and time of record.
BUT, the results are not showing up on default.asp. All I'm getting is "Active Members Record: | Record Set On: "

I think I'm close but can you see where I've gone wrong?<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Posted
Senior Member
masterao
Posts: 1678
1678
That seems correct. Have you added the two new fields into the database? Have you also added the variables into config.asp? I suspect that it is the last that you haven't done yet, which would explain why the new record and date isn't showing. If it isn't added in config.asp, the variables aren't populated.<
Posted
Senior Member
MarkJH
Posts: 1722
1722
It was the latter. smile
Something still isn't right, though. It's telling me that the active members record is 87! My forum's popular but not that popular!
There must still be some kind of error somewhere...<
Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
You Must enter a message