PDA

View Full Version : vB3 Forumhome Stats Cache Serialize hack v2.2


Pages : 1 [2]

Boofo
04-06-2004, 07:39 AM
Ok, I had a fix for the percentage code but yours might actually be better. Let's have a few of the larger boards try it and see if that fixes it for sure. If it works for the rest of you, I will update the hack with both changes. Thank you, sir. ;)

Nj?rd, where were you when I was tearing what little hair I have left out coming up with a fix for the percentages? You could have saved me some hair. ;)

Nj?rd Eriksson
04-06-2004, 09:58 AM
Ok, I had a fix for the percentage code but yours might actually be better. Let's have a few of the larger boards try it and see if that fixes it for sure. If it works for the rest of you, I will update the hack with both changes. Thank you, sir. ;)

Nj?rd, where were you when I was tearing what little hair I have left out coming up with a fix for the percentages? You could have saved me some hair. ;)
This is not really an acceptable fix I fear ... I just removed the if ... else conditionals from your solution (https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208) because it didn't work for me. If for anyone then mine will just work for larger boards. :|

djohn
04-06-2004, 03:50 PM
What exactly does 1 Uncached Template mean?
Does that uncashed template do any good/bad to my board?

Boofo
04-06-2004, 04:21 PM
An uncached template adds an extra query. Which template is uncached? If you followed the instructions in the very first part of the hack, then the templates are cached for this hack. You might want to recheck it. ;)

BarBeQue
04-06-2004, 05:48 PM
Sweet hack boofo!

Always wanted stats but never liked the amount of queries it added (you load them 10x a day and only view them like once....) but this solves it!

Gonna read the whole thread so i'll be back with questions/suggestions later prolly ;)

* BarBeQue clicks install!

djohn
04-06-2004, 05:55 PM
Woops, that post was supposed to go to this topic: https://vborg.vbsupport.ru/showthread.php?t=62173

Anyway, while we're at it, how can i "cash" some template? (I have no idea, which one is uncashed, i just know that there is one).

Seby
04-07-2004, 09:49 AM
i just updated to 2.2 and now i get this

please help me

you forgot to add the phrases:

Phrase Type: GLOBAL
Varname: bf2_active_members
Text: Active Registrations

Phrase Type: GLOBAL
Varname: bf2_members_new
Text: New Registrations Today

Phrase Type: GLOBAL
Varname: bf2_thread_views
Text: Thread Views

Phrase Type: GLOBAL
Varname: bf2_total_registrations
Text: Total Registrations

Phrase Type: GLOBAL
Varname: bf2_welcome_newest_member
Text: A warm welcome goes out to our newest member, <a href="{1}" target="_blank">{2}</a>.


I'll try your fix on my board as well Nj?rd Eriksson...

Boofo
04-07-2004, 10:00 AM
Let me know if it works, Seby. ;)

BarBeQue
04-07-2004, 11:46 AM
Boofo, any news on how to add the arcade stats to your hack?
Would love to have those added :D

Boofo
04-07-2004, 11:51 AM
Give me a few. I haven't added it yet even on my board. I will do that shortly. ;)

Nj?rd Eriksson
04-07-2004, 09:07 PM
Give me a few. I haven't added it yet even on my board. I will do that shortly. ;)
I'd love to have other things added (this is not urgent and should enjoy no priority):

For example, I installed the Board Spent Time Hack:
https://vborg.vbsupport.ru/showthread.php?t=60488

Is there a way to add the total spent time on the board (all members), then the the member who spent the most time on the board with his time (and maybe even expressed as a percentage of the total spent time)?

Also, I force people to choose a gender at registration. Is it possible to display "x% male, y% female"?

They also have to add their ethnicity (via a drop-down menu) ... again, would it be possible to display percentages (x% A, y% B, z% C, &c.)

Average age of the members? (compiled from those who have a valid age set?)

The possibilities seem to be endless. :)

Boofo
04-07-2004, 10:02 PM
Boofo, any news on how to add the arcade stats to your hack?
Would love to have those added :D

Ok, for those of you who have John's Excellent vB3 Arcade hack installed, here's a treat!

This addon will add a line to your Forumhome Stats to Display the Most Played Game (with a link directly to that game), the highest scorer in that game (the Champion) and his score.

Here we go!

In index.php, find:

// <!-- TOP REPUTATION -->
$toprep = $DB_site->query_first("
SELECT userid, username, reputation
FROM " . TABLE_PREFIX . "user
ORDER BY reputation
DESC LIMIT 1
");

BELOW it add:

// <!-- TOP ARCADE GAME -->
$mostactive = $DB_site->query_first("
SELECT COUNT(*) as total, gamesessions.gamename, games.title, games.gameid, MAX(gamesessions.score) as score, user.username, user.userid
FROM ".TABLE_PREFIX."gamesessions
INNER JOIN " . TABLE_PREFIX . "games AS games ON(gamesessions.gamename = games.shortname)
INNER JOIN " . TABLE_PREFIX . "user AS user ON(games.highscorerid = user.userid)
WHERE gamesessions.valid=1
GROUP BY gamesessions.gamename
ORDER BY total
DESC LIMIT 0,1
");

Find:

$statscache['lastupdate'] = intval (TIMENOW);

ABOVE it add:

$statscache['mostactivetotal'] = intval ($mostactive[total]);
$statscache['mostactivegamen'] = $mostactive[gamename];
$statscache['mostactivetitle'] = $mostactive[title];
$statscache['mostactivegameid'] = intval ($mostactive[gameid]);
$statscache['mostactivescore'] = intval ($mostactive[score]);
$statscache['mostactiveun'] = $mostactive[username];
$statscache['mostactiveid'] = intval ($mostactive[userid]);

Find:

$statscache['topreprep'] = vb_number_format($statscache['topreprep']);

BELOW it add:

$statscache['mostactivetotal'] = vb_number_format($statscache['mostactivetotal']);
$statscache['mostactivescore'] = vb_number_format($statscache['mostactivescore']);


Save and upload.

In the forumhome template, find:

<if condition="$show['reputation']">
<tr>
<td nowrap="nowrap"><span class="smallfont">Top Reputation: <a href="member.php?$session[sessionurl]u=$statscache[toprepid]">$statscache[toprepun]</a> (<b>$statscache[topreprep]</b> Reputation Points)</span></td>
</tr>
</if>

BELOW it add:

<tr>
<td nowrap="nowrap"><span class="smallfont">Most Active Arcade Game: <a href="$vboptions[bburl]/arcade.php?do=play&gameid=$statscache[mostactivegameid]">$statscache[mostactivetitle]</a> (<b>$statscache[mostactivetotal]</b> Total Plays -- Champion: <a href="member.php?$session[sessionurl]u=$statscache[mostactiveid]">$statscache[mostactiveun]</a> with <b>$statscache[mostactivescore]</b> Points)</span></td>
</tr>

Save the template.

NOTE: Don't forget to set the update time to 0 and refresh the page so the cache can get updated with the new stats. And don't forget to set it back to what you had it set at after updating the cache. ;)

You're done!
Enjoy!

Nj?rd Eriksson
04-08-2004, 06:15 AM
Works great, Boofo. Thanks for this one. ;)

Nj?rd Eriksson
04-08-2004, 06:51 AM
One suggestion: Would it also be possible to display how often the game has been played?

Boofo
04-08-2004, 10:25 AM
I think we would have to go another query for that. And there are already more than I originally wanted with this hack. :(

EDIT: I think I can do it with this same query. Hold on and I will test it and be right back to let you know for sure. ;)

The post above has been updated to count the Total Game Plays now. To add this, just redo the code that you added to the forumhome template. ;)

djohn
04-08-2004, 11:22 AM
Suggestion for the next version:
Options in ACP to turn on\off any stats line, that would rock!

Boofo
04-08-2004, 11:26 AM
If there's a stat in there you don't need, just take the query for it out and the line in the templates for it out. Having an option to turn off a stat is still going to let the query still run for it. And if I added the ability to turn off the query, too, this hack would get bloated a lot worse than it already is. ;)

egn
04-09-2004, 04:27 AM
Top Poster: l1quid (6 Posts = 66.67%)

There is only 6 posts, and I posted all 6 of them.. for somr reason it only shows me as posting in 2/3 of them

Boofo
04-09-2004, 05:19 AM
Run your counters and see if that strightens it out. If that doesn't work, then take out the percentage code. I will be dropping that in the next update. The only one I can seem to get it working right for is me. ;)

BarBeQue
04-09-2004, 08:24 AM
Actually, boofo....

The percentages don't all work on your own forums as well

See attachment

The top poster has 200 out of 2322, which is 8,61 % and not 6,85%
The other percentages are correct

I have the same problem, the top poster % is incorrect on my forum as well, while the others do work

Boofo
04-09-2004, 08:37 AM
Yes, they do. Add the posts and threads together before you divide. ;)

2322 + 595 = 2917

200 / 2917 = 0.0685636

0.0685636 = 6.85 %

Nj?rd Eriksson
04-09-2004, 11:39 AM
The post above has been updated to count the Total Game Plays now. To add this, just redo the code that you added to the forumhome template. ;) You are the man. ;)

BarBeQue
04-09-2004, 11:55 AM
Yes, they do. Add the posts and threads together before you divide. ;)

2322 + 595 = 2917

200 / 2917 = 0.0685636

0.0685636 = 6.85 %


wtf that's so wrong

ADD threads and posts???
that's double counting

if you have an empty board (like my test board) and make 1 thread, then you will have 1 thread, 1 post, BBQ posted 1 post (50%)

Now, that's just wrong. There is only 1 post and that's the thread post. You don't add threads and posts together

Boofo
04-09-2004, 01:00 PM
Look at how vBulletin counts them before you claim anything is wrong.

$totalthreads += $forum['threadcount'];
$totalposts += $forum['replycount'];

All I did was follow their way of doing it.

If you think it is wrong, just take out the code for the percentages. I'm going to remove it in the update, anyway.

And give me a link to your test board in pm so I can check it out.

BarBeQue
04-09-2004, 02:29 PM
Take out the percentages?

Nah, i just fixed your formule (yes fixed :p )
$statscache['topposterpercent'] = round(100 * ($topposter[posts] / ($totalposts)), 2);

now it's right again :D

Boofo
04-09-2004, 06:00 PM
First of all this satement is wrong:

$statscache['topposterpercent'] = round(100 * ($topposter[posts] / ($totalposts)), 2);

If should be:

$statscache['topposterpercent'] = round(100 * ($topposter[posts] / $totalposts), 2);

Second of all, if you have read the thread, you would see that this only works on small boards. On bigger boards you will get something like 15,300 % (your number would be different, but you get the idea) with your code.

And third, you are only counting replies this way, so you should call it Top Replier. ;)

Do what you want, but the code will come out of it in the next update. It's not worth messing with anymore.

surfhog
04-09-2004, 06:52 PM
hey boofo I'm back for round 2 attempt lol oh no he says...........

when i run the query iget error:
#1146 - Table **********.datastore' doesn't exist

so i guess i am missing something, should i be changing the title of the query?

please and thanks

Boofo
04-09-2004, 07:35 PM
Don't worry about the first query (the one with datastore in it). The datastore entries will be made when you install the code in the index.php and run the hack for the first time. ;)

surfhog
04-09-2004, 09:57 PM
:( lol lol

I have a different error now boofo, would you have any ideas please? seem like 1 error is solved then i get another........ lol

At least this time I did see the template, before i got the error lol ;)

Database error in vBulletin 3.0.0:

Invalid SQL:
SELECT profileviews,username,userid
FROM vb3_user
ORDER BY profileviews
DESC LIMIT 1

mysql error: Unknown column 'profileviews' in 'field list'

mysql error number: 1054

BarBeQue
04-09-2004, 10:27 PM
And third, you are only counting replies this way, so you should call it Top Replier. ;)

* BarBeQue gives up.... how can he convince boofo that adding posts with threads is doublecounting......

I counted each post on my board damnit and you do NOT add the threads to it cause threadposts are already included in the postcount

Make a new thread and you'll notice your postcount go up by 1.

Boofo
04-09-2004, 10:30 PM
:( lol lol

I have a different error now boofo, would you have any ideas please? seem like 1 error is solved then i get another........ lol

At least this time I did see the template, before i got the error lol ;)

Database error in vBulletin 3.0.0:

Invalid SQL:
SELECT profileviews,username,userid
FROM vb3_user
ORDER BY profileviews
DESC LIMIT 1

mysql error: Unknown column 'profileviews' in 'field list'

mysql error number: 1054

You need to run Query #2 for the profileviews, just not the datastore one. ;)

Boofo
04-09-2004, 10:32 PM
* BarBeQue gives up.... how can he convince boofo that adding posts with threads is doublecounting......


I counted each post on my board damnit and you do NOT add the threads to it cause threadposts are already included in the postcount

Make a new thread and you'll notice your postcount go up by 1.

You're wrong on that. Posts are replies and threads are threads. You better read the code a little more before you start spouting off.

You count it however you want to. I do it the way vbulletin does it. As long as it works for you the way you want it to now, what's the big deal?

surfhog
04-09-2004, 10:38 PM
I realized that I didnt do that :)

so i did that and get this error when I run the query:

#1146 - Table '*********_******.user' doesn't exist

sorry to keep asking boofo :(

Boofo
04-09-2004, 11:03 PM
Don't worry. we'll get you going. ;)

Ok, run the following query in the Admin CP >Import and Maintenance > Execute SQL Query (unless you are using phpmyadmin):

ALTER TABLE " . TABLE_PREFIX . "user ADD profileviews int(10) unsigned NOT NULL default '0'

and let me know if that runs allright. ;)

surfhog
04-09-2004, 11:41 PM
yes boofo I use phpadmin for queries, so would i run the same or would it be different script please. omg it's late here 01:40, I must be keen or just nutz lol

nope I tried the query and no it did not work same error :(

boofo are you on chat or would you have a spare moment to browse what i have done?

Boofo
04-10-2004, 12:09 AM
Do you have a table prefix?

surfhog
04-10-2004, 12:27 AM
yes Sir, I sure do..........

vb3_

Boofo
04-10-2004, 01:02 AM
Then use this query.

ALTER TABLE vb3_user ADD profileviews int(10) unsigned NOT NULL default '0'

surfhog
04-10-2004, 01:09 AM
thanks boofo - okay the query executed.

but I still have error:

Database error in vBulletin 3.0.0:

Invalid SQL:
SELECT COUNT(*) AS referrals, user.username, user.userid
FROM vb3_user AS users
LEFT JOIN vb3_user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 1

mysql error: Unknown table 'user' in field list

mysql error number: 1109

Boofo
04-10-2004, 01:17 AM
Ok, you NEED to have that code like I have it here:

// <!-- TOP REFERRER -->
$ref = $DB_site->query_first("
SELECT COUNT(*) AS referrals, user.username, user.userid
FROM " . TABLE_PREFIX . "user AS users
LEFT JOIN " . TABLE_PREFIX . "user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 1
");

Don't replace the TABLE_PREFIX with yours. Put this code in the file in place of the one you changed.

surfhog
04-10-2004, 10:50 AM
thanks boofo
i assume that you refering to the root/index.php file? if this is the case then it appears to me that its the same as the original code within your instructions? which is in place........

As you can see from the attachment, i hope.

Boofo
04-10-2004, 10:53 AM
You need to remove that file. There is no posting of vb files here. ;)

I will look into it. It should be working fine. For now, disable that query and take the code out for the referrer in the forumhome and see if everything works ok there. In the meantime, I will see what I can figure out with that one query for you.

surfhog
04-10-2004, 10:56 AM
ops!!! removed i hope :)
okay I will do as you say and thanks again

Boofo
04-10-2004, 10:59 AM
I am checking with someone on this now. You are not the first to report this happening although it runs fine for almost everyone else it seems. Strange. ;)

Boofo
04-10-2004, 11:01 AM
ops!!! removed i hope :)
okay I will do as you say and thanks again

Yes, it's gone. ;)

Don't forget the install button as there will be an update with more stats very soon and you don't want to miss the update. ;)

surfhog
04-10-2004, 11:05 AM
you are quite right and I will gladly do so, if and when it's working hehe lol

okay, I have done that and the errors appear to have gone :)

well maybe not? Because I get the stats block on forumhome and get nothing at the top of the forums namely: "Forum Quick Statistics" block

Boofo
04-10-2004, 12:37 PM
The one for the forums is a totally different hack. You need to install that one, too, if you want it above the forums. This hack here is the "forumhone" stats hack.

surfhog
04-10-2004, 12:42 PM
i see, i thought that was all part of the same hehe.which one would be then please.

thanks :)

what an idiot me :( i found it and already tried it once lol
https://vborg.vbsupport.ru/showthread.php?t=61581&page=5&pp=15&highlight=Forum+Quick+Stats (https://vborg.vbsupport.ru/showthread.php?t=61581&page=5&pp=15&highlight=Forum+Quick+Stats)

i best get some (-0-0-) getting them mixed up maybe....

BarBeQue
04-10-2004, 07:44 PM
Boofo,

Great hack, love it...

I noticed that the time, when the update takes place doesn't update to show the new time
Look at the pic to see what i mean.
At 22:18 was the last update, i enter at 22:30, your hack notices it's over 10 mins later and updates (see the 21 queries). All fine but the last update date still shows the previous update time, not the new one.
Anyway to change that to the new updated time?

Boofo
04-10-2004, 07:55 PM
As long as you didn't change these lines in the index.php:

$updatetime = 10;
$statsupdate = '';

$getupdatetime = vbdate("$vboptions[timeformat] - F jS, Y", $statscache['lastupdate']);
$statsupdate = "<font color=green>Last updated at $getupdatetime</font>&nbsp;";

if ($statscache['lastupdate'] == 0 OR ($statscache['lastupdate'] + ($updatetime * 60)) < TIMENOW)

it should be updating the time every 10 minutes.

BarBeQue
04-10-2004, 08:37 PM
I installed the admincp thing so i got this for code:
$updatetime = $vboptions['forumhomecachetime'];
$statsupdate = '';

$getupdatetime = vbdate("$vboptions[timeformat] - F jS, Y", $statscache['lastupdate']);
$statsupdate = "Last updated at $getupdatetime";

And in admincp i set the time to 10

The stats do update but the time shows the previous time when the update queries run. As soon as i press refresh and the cache gets read then it does show the new time

Boofo
04-10-2004, 09:07 PM
That's the way it is supposed to work.

Boofo
04-10-2004, 09:10 PM
ops!!! removed i hope :)
okay I will do as you say and thanks again

Ok, here is your fix.

Replace the top referrer code in the index.php with this:

// <!-- TOP REFERRER -->
$ref = $DB_site->query_first("
SELECT COUNT(*) AS referrals, user.username, user.userid
FROM " . TABLE_PREFIX . "user AS users
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
AND users.referrerid NOT IN (1)
GROUP BY users.referrerid
ORDER BY referrals
DESC LIMIT 1
");

Thanks to NTLDR for fiinding my mistake. ;)

BarBeQue
04-10-2004, 09:16 PM
Ok, i fixed my prob myself.

I removed the
$statsupdate = "<font color=green>Last updated at $getupdatetime</font>&nbsp;";from the orig place

Then AFTER the update stats "if" statement ended and the stats update time was added to the cache i added this:

$getupdatetime = vbdate("$vboptions[timeformat] - F jS, Y", $statscache['lastupdate']);
$statsupdate = "<font color=green>Last updated at $getupdatetime</font>&nbsp;";

Now it updates the queries AND the last update time at the same moment, when all the queries run.
See screenshot

yay!

Boofo
04-10-2004, 09:18 PM
That's the way I have it on my site. I just never chnaged it in the file on here. Oops! ;)

BarBeQue
04-10-2004, 09:21 PM
lol

glad it's fixed

Great hack!

Boofo
04-10-2004, 09:25 PM
You had doubts? ;)

surfhog
04-11-2004, 08:23 PM
thanks boofo

finally this appears to work now without any errors :)

I will post on the other threa ref forum quick stats, which i still have error :(


Ok, here is your fix.

Replace the top referrer code in the index.php with this:

// <!-- TOP REFERRER -->
$ref = $DB_site->query_first("
SELECT COUNT(*) AS referrals, user.username, user.userid
FROM " . TABLE_PREFIX . "user AS users
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
AND users.referrerid NOT IN (1)
GROUP BY users.referrerid
ORDER BY referrals
DESC LIMIT 1
");

Thanks to NTLDR for fiinding my mistake. ;)

Boofo
04-11-2004, 09:07 PM
thanks boofo

finally this appears to work now without any errors :)

I will post on the other threa ref forum quick stats, which i still have error :(

See? Now aren't you glad I didn't let you give up (in the pm)? ;)

Don't forget the install button, my friend. ;)

surfhog
04-11-2004, 09:13 PM
yes, yes and yes lol *hit install button*=yes

Thank you so much for your brilliant support :)

BlackTiger
04-17-2004, 12:51 AM
Cool Hack! Is the installation file also fully up2date now?

Boofo
04-17-2004, 01:24 AM
If you don't use a table prefix or have a really large board it is. I will update the file later tonight if you are either one of the afore mentioned. ;)

BlackTiger
04-17-2004, 02:02 PM
My board is not that big, and I just upgraded last night to 3.01 so if it would work on that, it's fine with me too.
But I'm a patient man so I can wait until all is updated so when installing all will work good. If that means waiting a few days, I don't mind.

Thanks for the support!

dstruct2k
04-17-2004, 11:21 PM
If you don't use a table prefix or have a really large board it is. I will update the file later tonight if you are either one of the afore mentioned. ;)
I was about to say that prefixes are broken by one query, but I see you've found that yourself. :) (I'll assume someone has posted a fix as well, although I've coded my own.)

Boofo
04-17-2004, 11:27 PM
I was about to say that prefixes are broken by one query, but I see you've found that yourself. :) (I'll assume someone has posted a fix as well, although I've coded my own.)

The fixes are on this page and the last one. ;)

Don't forget the install button as there will be an update shortly (in the next few days). ;)

dstruct2k
04-18-2004, 12:31 AM
Boofo -- I hope you're gonna fix the code for Top Thread Starter and Top Poster percentages to work with numbers over 1000. :)


Hint: The $totalposts and $totalthreads variables are sent through vb_number_format() BEFORE your hack runs. Numbers over 999 show up in the variables as "1,000" and as we all know, PHP can't do this: 1,002 / 9,534

(I've fixed this on my own, if you want my code, I'll give you it :p)

Boofo
04-18-2004, 12:51 AM
Boofo -- I hope you're gonna fix the code for Top Thread Starter and Top Poster percentages to work with numbers over 1000. :)


Hint: The $totalposts and $totalthreads variables are sent through vb_number_format() BEFORE your hack runs. Numbers over 999 show up in the variables as "1,000" and as we all know, PHP can't do this: 1,002 / 9,534

(I've fixed this on my own, if you want my code, I'll give you it :p)

PM me what you have and I will take a look at it. I did solve the problem but I had to run an extra query to do it. Maybe your way would be better. ;)

Chris|vB
04-20-2004, 11:45 PM
Nice hack.

Majik?
04-23-2004, 12:41 AM
Just installed with no problems, but I've cahnged it to update the stats via CRON. All of my scheduled tasks are done via a real CRON. I have it updating the cache every 5 minutes, which is good enough.

Had thought about every couple minutes, but 5's a nice good number. ;) Now users will always be loading the stats from the cache. I jsut have to decide now how I want to group the stats because I'm going to break up the list a bit into sections (instead of one big list).

Great job! :D

Boofo
04-23-2004, 05:00 AM
Just installed with no problems, but I've cahnged it to update the stats via CRON. All of my scheduled tasks are done via a real CRON. I have it updating the cache every 5 minutes, which is good enough.

Had thought about every couple minutes, but 5's a nice good number. ;) Now users will always be loading the stats from the cache. I jsut have to decide now how I want to group the stats because I'm going to break up the list a bit into sections (instead of one big list).

Great job! :D

I thought about using a cron job, but I like the option in the vb settings where I can change it on the fly. But, hey, whatever works for you, my friend. ;)

Majik?
04-24-2004, 02:14 AM
I never noticed before, but a member had pointed out to me that the thread views are showing as "0". Since I never notcied this before, I'll have to have a look at the CRON script I made.. Maybe I missed somehting, unless it was always that way.

Just looked and I have the threadview stuff where it should be.. It's the only thing that's not showing properly apparently. I have both the following as it should be in the CRON script..// <!-- THREAD VIEWS -->
$getthreadviews=$DB_site->query_first("
SELECT SUM(views) AS tviews
FROM " . TABLE_PREFIX . "thread
");
$statscache['getthreadviews'] = intval ($getthreadviews[tviews]);

And the following in "/index.php".. $statscache['getthreadviews'] = vb_number_format($statscache['getthreadviews']);

Boofo
04-24-2004, 02:23 AM
You missed something. That's why I have an option in the settings instead of doing it via cron job. ;)

Majik?
04-24-2004, 02:26 AM
You missed something. That's why I have an option in the settings instead of doing it via cron job. ;)I checke dand everything appears to be where it should be.. That and it's the only tihng not working.. Maybe t was like that before, I don't know becasue I never noticed. Am I missing something?

Boofo
04-24-2004, 02:33 AM
It works fine for me and everyone else. You missed something in your script. Look at the install file and see what you forgot to add. ;)

Majik?
04-24-2004, 02:42 AM
I just chekced in phpMyAdmin and actally that's correct which I don't get.. The SUM does return 0. But, If I look at the threadviews table, there are numerous rows (pages of them).. But, thread.views is set to 0 for all threads. Would I be able to do a COUNT on the threadviews table and get the same result?

I looked in the install file again and everything relating to thread views is where it should be (that I saw anyhow).

Boofo
04-24-2004, 02:52 AM
If it is showing 0 for thread views in the table, then you have something else going on. As long as you have this query:

// <!-- TOTAL THREAD VIEWS -->
$getthreadviews=$DB_site->query_first("
SELECT SUM(views) AS tviews
FROM " . TABLE_PREFIX . "thread
");

and this code:

$statscache['getthreadviews'] = intval ($getthreadviews[tviews]);

and this variable in the forumhome template:

$statscache[getthreadviews]

then it will return whatever the table has in it for thread views.

Try this: Take the cron job off for this and set it up like in the install file and let it run for a few minutes and see if they start showing up then. Make sure to set the cache update time to 0 to test it.

Majik?
04-24-2004, 02:56 AM
If it is showing 0 for thread views in the table, then you have something else going on. As long as you have this query:

// <!-- TOTAL THREAD VIEWS -->
$getthreadviews=$DB_site->query_first("
SELECT SUM(views) AS tviews
FROM " . TABLE_PREFIX . "thread
");

and this code:

$statscache['getthreadviews'] = intval ($getthreadviews[tviews]);

and this variable in the forumhome template:

$statscache[getthreadviews]

then it will return whatever the table has in it for thread views.

Try this: Take the cron job off for this and set it up like in the install file and let it run for a few minutes and see if they start showing up then. Make sure to set the cache update time to 0 to test it.Okay, but I don't know what difference that would make as I looked in the database directly and thread.views is set to "0" for all threads.. But, thread views are displaying in the forums as they should be. :S

I'd already changed it to do a COUNT on the threadviews table and now it's showing thread views as "2,827". I have thread views set to update hourly and noticed that the threadviews table's used for hourly updates instead of updating thread.views immediately upon viewing.// update views counter
if ($vboptions['threadviewslive'])
{
// doing it as they happen
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "thread
SET views = views + 1
WHERE threadid = " . intval($threadinfo['threadid'])
);
}
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "threadviews (threadid)
VALUES (" . intval($threadinfo['threadid']) . ')'
);
}
Will have to look at vB's CRON script and see why the thread.views isn't being updated.. But, the views are displaying i the forums htough. :S

Majik?
04-24-2004, 03:27 AM
I had to add // ####################### SET PHP ENVIRONMENT ###########################
ignore_user_abort(1);
@set_time_limit(0);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('SESSION_BYPASS', 1);
define('LOCATION_BYPASS', 1);
define('THIS_SCRIPT', 'cron');

// ######################### REQUIRE BACK-END ############################
chdir('/path/to/forum/');
require_once('./global.php');
require_once('./includes/functions_cron.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

to the top of the threadviews.php CRON script.. for some reason the other vB CRONs are running okay though.. It's strange because thread views were increasing, but were no where near as high as they are now that thread.views has been updated. It's now around 13,000.

It's the only cron that wasn' running properly for one reason or another, promotions, ban removal, etc. were all being done.

Boofo
04-24-2004, 04:19 AM
See? that's what happens when you take a hack that wasn't meant to be run by cron job and try to do it that way. At least you got it working your way now. ;)

Majik?
04-24-2004, 04:23 AM
See? that's what happens when you take a hack that wasn't meant to be run by cron job and try to do it that way. At least you got it working your way now. ;)Well, it wasn't a problem with your script.. It was with vB's default threadviews.php CRON script not running properly all the time. All the others were running except for that one and possibly he attachmentviews one (never checked).

I put them all into the real CRON though because it's better then running hrough a fake CRON. All is well now though. :D

Ian Emu-UK
04-25-2004, 06:33 PM
Boofo -- I hope you're gonna fix the code for Top Thread Starter and Top Poster percentages to work with numbers over 1000. :)


Hint: The $totalposts and $totalthreads variables are sent through vb_number_format() BEFORE your hack runs. Numbers over 999 show up in the variables as "1,000" and as we all know, PHP can't do this: 1,002 / 9,534

(I've fixed this on my own, if you want my code, I'll give you it :p)
I would also be interest if you'd like to share ;)

Boofo
04-25-2004, 08:42 PM
I would also be interest if you'd like to share ;)

There will be an update in the next day or two that will fix that problem as well as add a couple more stats to this hack.

Ian Emu-UK
04-25-2004, 11:36 PM
Excellent, thanks for that :)

Chris|vB
05-03-2004, 11:56 PM
* clicks install

thanks

Pseudomizer
05-04-2004, 12:14 AM
There will be an update in the next day or two that will fix that problem as well as add a couple more stats to this hack.

Hey mate ? I have some questions for you.

What performance benefit does this hack bring to my portal site ? Any experiences yet ? I read one query less. Right ? :nervous:

Before i try to install this version, you just mentioned above that you will bring out a new version. The first thread was not updated since 7th of april. So i assume you had no time yet to finish the new version ? :tired:

Please tell me when you finish it and i go for it. I don't want to do things twice. ;-)

Cheers buddy,

Boofo
05-04-2004, 12:35 AM
I'm not sure how I'm going to work this quite yet. Apparently there are sites out there that download the hacks here and put them up for download on their site without permission and I'm really getting sick of releasing hacks that end up that way. Some of them are in other countries where Jelsoft will have a hard time doing anything about.

Any new hacks or future upgrades I do to my hacks will probably only be available on my site. I can watch things a little closer that way.

Pseudomizer
05-04-2004, 08:20 AM
I'm not sure how I'm going to work this quite yet. Apparently there are sites out there that download the hacks here and put them up for download on their site without permission and I'm really getting sick of releasing hacks that end up that way. Some of them are in other countries where Jelsoft will have a hard time doing anything about.

Any new hacks or future upgrades I do to my hacks will probably only be available on my site. I can watch things a little closer that way.

I don't think that your own site will prevent them from spreading. You usergroup is small and fine but if you create one day THE perfect hack and everyone wants to have it, then your site will be overrun and you will have the same like.

Cheers,

Boofo
05-04-2004, 10:28 AM
I don't think that your own site will prevent them from spreading. You usergroup is small and fine but if you create one day THE perfect hack and everyone wants to have it, then your site will be overrun and you will have the same like.

Cheers,

I doubt we have anything to worry about me either creating THE perfect hack or my site ever getting overrun with anyone wanting something like that. If that's the only way I can keep an eye on my hacks and keep them from getting put on warez sites or whatever, then I guess that's what I'm going to have to do. Don't worry, buddy, you have the access you need to get them. ;)

Pseudomizer
05-04-2004, 10:37 AM
I doubt we have anything to worry about me either creating THE perfect hack or my site ever getting overrun with anyone wanting something like that. If that's the only way I can keep an eye on my hacks and keep them from getting put on warez sites or whatever, then I guess that's what I'm going to have to do. Don't worry, buddy, you have the access you need to get them. ;)

Yeah. :smoke:

Cheers,

ChrisLM2001
05-04-2004, 07:00 PM
Thought you might like to see how I worked this into the nav.. Love the hack! good job!! ;)
Ah, man, ah, man, ah, man....just when you thought you had your design figured out! :)

This is a great mod for those who love stats. On the navbar, it's even sweeter!

Adding it to my list of "to do" projects.....

Chris

Pseudomizer
05-04-2004, 09:01 PM
Hi Boofo,

i need a quick guidance in here. The field of "Most viewed Profile" is every time 0. Even if i go in my own profile with the IE and use another username with Opera and set the interval to update every 1 minute. Every time it is 0.

I searched this thread but no one had this problem before. :ermm:

Any ideas why ?

Cheers,

*clicked install even if it is installed only on the testboard yet*

Boofo
05-05-2004, 01:53 AM
If you are view your own profile, it won't add views to it. I did that so someone couldn't rack up the profileviews on their own account by continually refreshing it. ;)

Try viewing someone else's profile a few times and it will show up (as long as you have the query added to the member.php, that is). ;)

Pseudomizer
05-05-2004, 07:58 AM
If you are view your own profile, it won't add views to it. I did that so someone couldn't rack up the profileviews on their own account by continually refreshing it. ;)

Try viewing someone else's profile a few times and it will show up (as long as you have the query added to the member.php, that is). ;)

Good job to prevent someone pushing up the number of views for their own profile. Now i tested with multiple users and it works.

I heading now for the install on the live board. Good job with this hack.

Cheers,

Astovidatu
05-05-2004, 02:36 PM
Yea, nice job!
But i think theres an error: "Top Poster: Astovidatu (756 Posts = 142,93%)" <- hows taht possible?

Pseudomizer
05-05-2004, 03:17 PM
Yea, nice job!
But i think theres an error: "Top Poster: Astovidatu (756 Posts = 142,93%)" <- hows taht possible?

Perhaps you missed that part here (https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208)

Just an idea.

Cheers,

Astovidatu
05-06-2004, 07:39 AM
Perhaps you missed that part here (https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208)

Just an idea.

Cheers,
Yep indeed, thanks. Dut now it looks like this:
Top Poster: Astovidatu (756 Posts = 0,14%)

Thats not possible either by a sum of 3000 Posts total.

Boofo
05-06-2004, 07:49 AM
Thanks, but now it looks like this:
Top Poster: Astovidatu (756 Posts = 142.93)
Top Thread Starter: Astovidatu (121 Threads = 23)

The same just without percentage sign.

My code:

$statscache['newthreads'] = intval ($newestthreads[count]) ;
$statscache['newposts'] = intval ($newestposts[count]);
$statscache['newusers'] = intval ($newestusers[count]);
$statscache['getthreadviews'] = intval ($getthreadviews[tviews]);
$statscache['topposter'] = $topposter[username];
$statscache['topposterid'] = intval ($topposter[userid]);
$statscache['toppostercount'] = intval ($topposter[posts]);
if($statscache['topposterpercent'] > 100)
{
$statscache['topposterpercent'] = vb_number_format(($topposter[posts] / ($totalthreads + $totalposts)) * 100 / 1000, 2 ) . '%';
}
else
{
$statscache['topposterpercent'] = vb_number_format(($topposter[posts] / ($totalthreads + $totalposts)) * 100, 2) . '%';
}
$statscache['topstarter'] = $topstarter[postusername];
$statscache['topstarterid'] = intval ($topstarter[postuserid]);
$statscache['topstartercount'] = intval ($topstarter[count]);
if($statscache['topthreadspercent'] > 100)
{
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100 / 1000, 2 ) . '%';
}
else
{
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100, 2) . '%';
}
$statscache['getfileviewsun'] = $getfileviews[username];
$statscache['getfileviewsid'] = intval ($getfileviews[userid]);
$statscache['getfileviews'] = intval ($getfileviews[profileviews]);
$statscache['ref2'] = $ref[username];
$statscache['topreferrerid'] = intval ($ref[userid]);
$statscache['ref'] = intval ($ref[referrals]);
$statscache['toprepun'] = $toprep[username];
$statscache['toprepid'] = intval ($toprep[userid]);
$statscache['topreprep'] = intval ($toprep[reputation]);
$statscache['lastupdate'] = intval (TIMENOW);

and I deleted the 2 if - else statements you told.

I have a fix for all of the percentages that I am working on getting into the install file now. You might want to click the install button so when update the hack in the next few days, that you will be notified.

ImportPassion
05-08-2004, 09:42 PM
Little problem here

Most Viewed Profile: 007 (0 Views)

Oh, just noticed this too...
Last updated at 07:00 PM - December 31st, 1969

After first update.

Shouldn't this default to N/A or something?

Boofo
05-09-2004, 07:39 AM
Little problem here

Most Viewed Profile: 007 (0 Views)

Oh, just noticed this too...
Last updated at 07:00 PM - December 31st, 1969

After first update.

Shouldn't this default to N/A or something?
You need to set the updatetime to 0 and run it a couple of times when you first install it. The profileviews will only update when you view someone's profile and NOT your own. I don't have it counting views when the person is looking at their own profile. Look at someone else's profile a couple of times and it will show up.

ImportPassion
05-09-2004, 10:58 AM
ok, i will check it out. but that profile is not mine.

Boofo
05-09-2004, 11:08 AM
ok, i will check it out. but that profile is not mine.
Did you run the query and add the code to the member.php?

Chriss74
05-09-2004, 03:09 PM
Thanks for this hack!

I'd like to have this statistics on a separate site. This statistics-site should include further statistics:
- recent attachments
- Number of Active Users Today
- 5 most read threads
- 5 threads with most answers
- last 5 threads
- last 5 new members
- average data: posts per member, posts per forum, answers per thread, new posts per day, new members per day, xy % of all members posted at least 1 posting

I began to write something for my board (have a look at the attachment). But it doesn't use the cache. Therefore it would be nice, if somebody could make one hack with all features.

Greetings,
Chriss

Boofo
05-10-2004, 12:54 AM
Thanks for this hack!

I'd like to have this statistics on a separate site. This statistics-site should include further statistics:
- recent attachments
- Number of Active Users Today
- 5 most read threads
- 5 threads with most answers
- last 5 threads
- last 5 new members
- average data: posts per member, posts per forum, answers per thread, new posts per day, new members per day, xy % of all members posted at least 1 posting

I began to write something for my board (have a look at the attachment). But it doesn't use the cache. Therefore it would be nice, if somebody could make one hack with all features.

Greetings,
Chriss
Don't forget to click the install button. ;)

Astovidatu
05-14-2004, 09:26 AM
Nice Ideas Chriss74...
But what about the fix for the Percantage stat? Shouldnt that have priority to more Stats.

Boofo
05-14-2004, 09:36 AM
Nice Ideas Chriss74...
But what about the fix for the Percantage stat? Shouldnt that have priority to more Stats.
The percentages are fixed. I am redoing (completely re-writing) the install file now. I will notify those that have clicked the install button when I upload the new file. I need to test it first to make sure I have left nothing out, though. If anyone is interested in helping test this, contact me PM.

paratek
05-14-2004, 03:50 PM
How do you add the Most Active User today?....i don't see it refered to in the code

Boofo
05-14-2004, 03:56 PM
How do you add the Most Active User today?....i don't see it refered to in the code
That will be available in the coming update. That is from a hack by Kentaurus (who authoriuzed me to use it in the stats hack). If you're interested, you can help me test the update to make sure I didn't forget anything in it. ;)

paratek
05-14-2004, 03:57 PM
Absolutely Boofo, let me know

Boofo
05-14-2004, 04:03 PM
Absolutely Boofo, let me know
Head to the site and pm me there. ;)

Chriss74
05-15-2004, 05:43 PM
That will be available in the coming update. That is from a hack by Kentaurus (who authoriuzed me to use it in the stats hack). If you're interested, you can help me test the update to make sure I didn't forget anything in it. ;)That's right. I used the hack from Kentaraus.

@Boofo: Will your new/enhanced version of your Stats hack be installed on a separate site or again at the index-page? I would prefer a separate page.

Greetings,
Chriss

y2krazy
05-16-2004, 12:20 AM
Why am I getting this message? Please help! :(

Parsing functions.php Time before: 1084670228.3792 Time after: 1084670228.4013 Time taken: 0.022105932235718
Processing sessions.php Time before: 1084670228.4015

http://forums.bladestorm.net/ is where my forums are located.

-y2k-

Boofo
05-16-2004, 02:12 AM
That doesn't have anything to do with this hack. ;)

Boofo
05-16-2004, 02:14 AM
That's right. I used the hack from Kentaraus.

@Boofo: Will your new/enhanced version of your Stats hack be installed on a separate site or again at the index-page? I would prefer a separate page.

Greetings,
Chriss
I won't be doing a separate page as there really isn't enough stats to warrant a whole new page for them. Sorry. ;)

Astovidatu
05-19-2004, 07:54 AM
The percentages are fixed.

It doesent work on my Forum...
take a look: www.security-board.org

Boofo
05-19-2004, 12:27 PM
It doesent work on my Forum...
take a look: www.security-board.org (http://www.security-board.org)
The percentages ARE fixed in the update I am testing now that will be released in the next day or two.

kall
05-23-2004, 08:18 PM
Oops. Never mind.

I was thinking of another hack.

This one is brilliant...except for some reason the Time last updated on my new server is showing as 1970...

Nj?rd Eriksson
05-28-2004, 11:17 AM
This is really a minor issue but is there a way to insert a "," into the number of "Total Registrations"?

Total Registrations: 2926, Active Registrations: 2,040, New Registrations Today: 11

Boofo
05-28-2004, 04:15 PM
This is really a minor issue but is there a way to insert a "," into the number of "Total Registrations"?


Total Registrations: 2926, Active Registrations: 2,040, New Registrations Today: 11That is fixed along with the percentages and a few other stats added in the new version I am putting together. The install file is done, I just need to test it on a new install to make sure I didn't leave anything out. ;)

Nj?rd Eriksson
05-29-2004, 07:20 PM
That is fixed along with the percentages and a few other stats added in the new version I am putting together. The install file is done, I just need to test it on a new install to make sure I didn't leave anything out. ;)
Thank you kindly, Sir!

I just installed your vB3 Forum Quick Stats Cache Serialize Hack which is great, too. I saw that it displays the number of attachments and the total size attachments take in every forum.

Would it be possible to add an option with the new version to display the total number of attachments and the total attachment size for the whole board on the forum home? :)

Mijae
06-01-2004, 10:05 AM
So, where is our fix? :P

Photon
06-19-2004, 11:17 AM
installed it without any problems and it looks very nice :)

starfantazy
06-23-2004, 08:11 AM
Its not working for me...Anime Gamers (http://www.anime-gamers.com/forums/vb.php)

kall
06-25-2004, 05:39 AM
What would I have to add to the queries to exclude specific forums from the 'new posts/threads since last visit' stats?

I have the NNTP gateway hack installed, and I would rather not have these show in any of the stats.

(As per a suggestion from wayne luke over on TAZ, I have added a SMALLINT column called is_usenet to my forum table).

Boofo
06-25-2004, 08:41 AM
Its not working for me...Anime Gamers (http://www.anime-gamers.com/forums/vb.php)
What part of it is not working for you? It will only show up to registered members.

Boofo
06-25-2004, 08:43 AM
What would I have to add to the queries to exclude specific forums from the 'new posts/threads since last visit' stats?

I have the NNTP gateway hack installed, and I would rather not have these show in any of the stats.

(As per a suggestion from wayne luke over on TAZ, I have added a SMALLINT column called is_usenet to my forum table).
Give me the forum ID of the fourm you want to exclude and I will let you know what you need to change.

kall
06-25-2004, 08:45 AM
Give me the forum ID of the fourm you want to exclude and I will let you know what you need to change.
*salutes*

It's number 41

:)

Alos, if it's possible to have these posts not be counted towards the total, that would be awesome.

kall
06-28-2004, 09:49 AM
Another consideration: rather than a forum, can it be a category?

Or, will it exclude from that forum and all subforums?

(main consideration now being the Total posts/Total threads having these specified forums be excluded from the count.)

Mijae
06-29-2004, 10:47 PM
Its been months since you promised to fix the % :P

Boofo
06-30-2004, 01:56 AM
Its been months since you promised to fix the % :P
Not quite, but getting close. You should have PM'd me on my site. I have it fixed and running there, I just haven't gotten the install file done quite yet. Partly due to my own laziness and partly due to my Father's death 2 weeks ago. I'm trying to get back on track now. Give me a few days and then PM me on the site and I will give you what I have for the install file and you can help me make sure everything is there and it works for you. I need to test it somewhere other than just my site.

Will that work? ;)

PranK
06-30-2004, 11:22 AM
Thanks Boofo.

/me clicks install

Hey, how do i get 'visits to this page' stats like in your screeny ?

Thanks again!

Boofo
06-30-2004, 03:41 PM
Thanks Boofo.

* PranK clicks install


Hey, how do i get 'visits to this page' stats like in your screeny ?

Thanks again!
That's an add-on in my version. If you want it, let me know. It will add 2 queries, though. ;)

You missed the install button. ;)

bandit022
07-02-2004, 04:42 PM
hey... nice hack. i've been looking for something like this.

but, i am getting this database error when i upload the member.php and index.php

Database error in vBulletin 3.0.1:

Invalid SQL:
SELECT profileviews,username,userid
FROM user
ORDER BY profileviews
DESC LIMIT 1

mysql error: Unknown column 'profileviews' in 'field list'

mysql error number: 1054

any idea why?

thanks,

-jeff

kall
07-02-2004, 10:00 PM
Did you perhaps install another hack of similar purpose?

I had one of the other hacks installed, it dropped that column from the table.

Have a look back through the install files for DROP.

bandit022
07-03-2004, 01:21 AM
Did you perhaps install another hack of similar purpose?

I had one of the other hacks installed, it dropped that column from the table.

Have a look back through the install files for DROP.

yeah... now that i think of it, i did have a "vbstats" hack installed back in the vb2 days...

so how would i go about fixing the needed table for this new stats hack?

Boofo
07-03-2004, 02:51 AM
Did you run the query in the first part of the instructions?

weitalia
07-04-2004, 12:50 PM
It's strange: i try the original 2.2 version and I get like everyone weird percentages,like thousand or more.
I try THIS (https://vborg.vbsupport.ru/showpost.php?p=509426&postcount=347) fix suggested by Boofo,but i get very low values of percentages...
Example : Total Posts : 124000 - Top Poster : 4900 Percentage : 3.68% ????
I am waiting your last fix like everyone here. Last but not least: congratulations i love this hack veeery fast ;)

Boofo
07-04-2004, 01:05 PM
I will have a fix out shortly. Just bear with me for a few days. ;)

Seby
07-04-2004, 07:02 PM
hey boofo, I have a relatively large board, I can help testing if needed. I helped you before ;)

- Sebastian

Boofo
07-04-2004, 08:22 PM
hey boofo, I have a relatively large board, I can help testing if needed. I helped you before ;)

- Sebastian
You're regged on my board, aren't you?

Seby
07-04-2004, 08:39 PM
nope, don't think so... we just sent pms before...

Boofo
07-04-2004, 08:50 PM
nope, don't think so... we just sent pms before...
Then you might want to. That is where I will be doing the testing before I release the fix.

Frzzy
07-11-2004, 08:17 PM
Don't know y, it messed up the percents... the displayed figures is 1000 times greater than what it should be...

So I have to change to these:
$statscache['topposterpercent'] = round(($topposter[posts] / ($totalthreads + $totalposts)) / 10, 2);
$statscache['topthreadspercent'] = round(($topstarter[count] / $totalthreads) / 10, 2);
Or either remove:
$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);
From the index.php, for it to work right... anyone have the same problem?

turbidblue
07-12-2004, 03:48 AM
* turbidblue edits my problem out, fixed! ;)

weitalia
07-13-2004, 10:43 AM
Frzzy thanx so much,this semms to be perfect!!
I just make little change,for not loose the VB Number feature ;)
In root/index.php find:

$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);

Above it add:

$totalt = $totalthreads;
$totalp = $totalposts;

Go forward in index.php and find:

$statscache['topstarterid'] = intval ($topstarter[postuserid]);
$statscache['topstartercount'] = intval ($topstarter[count]);
Under it add:

$statscache['topposterpercent'] = round(($topposter[posts] / ($totalt + $totalp)) / 10, 2);
$statscache['topthreadspercent'] = round(($topstarter[count] / $totalt) / 10, 2);

This works perfect to me,and all thanx goes to Frzzy!

;)

nelto
09-04-2004, 07:09 PM
Hi guys

I tried to install this hack wich I want it so bad becouse Im runing a contest for the top ref and top poster, but Im havign a prb

Im runing the lattes VB and when it comes for the last part of this installement include/init.php Im geting a nasty sql error

" In includes/init.php

Find:
*****************************

// add default special templates
$specialtemplates = array_merge(array(
'options',
'cron',
'forumcache',
'usergroupcache',
'stylecache'
), $specialtemplates); "

So basicly its just to had "'statscache'" so I changed it uploaded it and when I refresh the site I get this:

" Parse error: parse error, expecting `')'' in /usr/home/kain/domains/bbs.tgpbuilders.com/includes/init.php on line 517
Parsing functions.php Time before: 1094328813.74 Memory Before: 568KB Time after: 1094328813.82 Time taken: 0.0754599571228 Memory After: 1,252KB "

Any Ideas?

Lion's Heart
10-09-2004, 12:58 PM
I have one question with this mod.

IN my forum, it's display:

Total Registrations: 1050
And Active Registrations: 1050

But my Users Awaiting Email Confirmation Group have 243 members

=> my Active Registrations must be 807 (#1050)
:) can u help me?

sabret00the
11-06-2004, 12:55 PM
is their anyway to add total pm's sent in a 24 hour period to this?

Boofo
11-06-2004, 01:11 PM
is their anyway to add total pm's sent in a 24 hour period to this?
I'm not quite sure just how I could do that. I'll look into it for you if you want, though. ;)

Lethal
12-15-2004, 07:51 PM
can you add this to a VBAdvanced module block? like the quick stats block but have all of these stats instead?

tomshawk
12-22-2004, 03:31 AM
tomshawk clicks install!!!

Nice hack Boofo, thank you

One question though, in the image you have attached, it shows "The most Active User Today"

Well I installed it on my site, but I dont see that line.

Can you give me an idea what I might be missing, this is one of the main reasons I installed this, and I'd really like to get it working ;)

Thanks again

paulmjno
12-22-2004, 05:46 AM
can you add this to a VBAdvanced module block? like the quick stats block but have all of these stats instead?
Amen.

Boofo
12-22-2004, 06:11 AM
Amen.
Why the Amen? Have you installed this hack?

Gemma
12-22-2004, 08:46 AM
Anyone know how I would go about add Total Games and Most Played Game stats from the ibproarcade for vb hack?

Boofo
12-22-2004, 09:53 AM
Anyone know how I would go about add Total Games and Most Played Game stats from the ibproarcade for vb hack?
The updated version I am getting ready to release has just what you are looking for in it. It also has the Champion of the most played game and their score. Click the install button and when I get the text file all put together and tested, I will send out the update email for it. In the meantime, I have that running on my site if you want to check it out. ;)

TwinsX2Dad
12-22-2004, 03:11 PM
Will it include the same for v3arcade?

Frzzy thanx so much,this semms to be perfect!!
I just make little change,for not loose the VB Number feature ;)
In root/index.php find:

$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);

Above it add:

$totalt = $totalthreads;
$totalp = $totalposts;

Go forward in index.php and find:

$statscache['topstarterid'] = intval ($topstarter[postuserid]);
$statscache['topstartercount'] = intval ($topstarter[count]);
Under it add:

$statscache['topposterpercent'] = round(($topposter[posts] / ($totalt + $totalp)) / 10, 2);
$statscache['topthreadspercent'] = round(($topstarter[count] / $totalt) / 10, 2);

This works perfect to me,and all thanx goes to Frzzy!

;)

Caused a zero percentage, in the Top Poster, for me. The 'Most Viewed Profile' also doesn't work, showing '0 Views'

Brent H
12-22-2004, 06:54 PM
Great hack, but I'm getting this:

Threads: 291 (5 Today), Posts: 2,756 (27 Today), Thread Views: 25,485
Total Registrations: 78, Active Registrations: 61
There has been 1 new post since your last visit, TheHeggy.
Top Poster: TheHeggy (488 Posts = 166.55%)
Top Thread Starter: TheHeggy (101 Threads = 34.71%)
Top Referrer: TheHeggy (8 Referrals)
Most Viewed Profile: TheHeggy (0 Views)
A warm welcome goes out to our newest member, Test Account.

What can be done to correct this?

Boofo
12-22-2004, 07:45 PM
There has been a fix for that in this thread already. ;)

Boofo
12-22-2004, 07:49 PM
Will it include the same for v3arcade?
I'm sure we can include that also. I used to run v3Arcade and had the query there. ;)

Caused a zero percentage, in the Top Poster, for me. The 'Most Viewed Profile' also doesn't work, showing '0 Views'
You need to run the query for the most viewed profile and do the member.php edit and look at a couple of profiles other than your own and it will start showing up. ;)

Moncal
03-07-2005, 05:00 AM
This hack has almost every thing I need. Thanks a lot. I had a problem with the percentage of top poster only. And I couldn't figure it out even after reading this thread. I finally fixed it by rewriting the statement, now it is off by about 4 tenths of a percent and I really couldn't care less. :)

$statscache['topposterpercent'] = round(($topposter[posts] / ($totalposts)/10), 2);

Boofo
03-07-2005, 05:15 AM
This hack has almost every thing I need. Thanks a lot. I had a problem with the percentage of top poster only. And I couldn't figure it out even after reading this thread. I finally fixed it by rewriting the statement, now it is off by about 4 tenths of a percent and I really couldn't care less. :)

$statscache['topposterpercent'] = round(($topposter[posts] / ($totalposts)/10), 2);

I have an update that fixes all of the percentage problems and is accurate and also has a few more items in it. I just haven't gotten the text file together yet to update it. I will try to get that going here shortly. ;)

Moncal
03-07-2005, 10:03 PM
I have an update that fixes all of the percentage problems and is accurate and also has a few more items in it. I just haven't gotten the text file together yet to update it. I will try to get that going here shortly. ;)
Okay, thanks.

Just our of curiosity, why does it only count the profile views after the hack has been installed. I mean, if I had 1000 profile views before I installed the hack it would only show up as 1 if someone viewed my profile. Or is this just because I updated vB and moved it to another directory so that the URL's changed?

Boofo
03-07-2005, 10:37 PM
Okay, thanks.

Just our of curiosity, why does it only count the profile views after the hack has been installed. I mean, if I had 1000 profile views before I installed the hack it would only show up as 1 if someone viewed my profile. Or is this just because I updated vB and moved it to another directory so that the URL's changed?

Because profile views aren't counted by default. They are only counted after you run the query and only for anyone other than who the profile belongs to. If it is your profile and you are viewing it, it doesn't get counted, only when someone else views it. ;)

Moncal
03-08-2005, 10:27 AM
Because profile views aren't counted by default. They are only counted after you run the query and only for anyone other than who the profile belongs to. If it is your profile and you are viewing it, it doesn't get counted, only when someone else views it. ;)
Okay, that makes sense. Thanks.

vakvak
03-19-2005, 09:55 PM
// add default special templates
$specialtemplates = array_merge(array(
'options',
'cron',
'forumcache',
'usergroupcache',
'stylecache',
'statscache'
), $specialtemplates);
Parse error: parse error, unexpected '}' in /home/pcteknik/public_html/forum/includes/init.php on line 644

help pls vb 3.0.7

vakvak
03-20-2005, 02:46 PM
Installation overview:
Queries to run: (2) i to apply no problem
Files to edit: (2) i to apply no problem
--index.php
--member.php
Templates to edit: (1) i to apply no problem
--forumhome
Settings to add: (1)not to know ?
--forumhomecachetime
Parse error: parse error, unexpected '}' in /home/pcteknik/public_html/forum/includes/init.php on line 644

help pls vb 3.0.7

yinyang
03-20-2005, 04:43 PM
I have an update that fixes all of the percentage problems and is accurate and also has a few more items in it. I just haven't gotten the text file together yet to update it. I will try to get that going here shortly. ;)

any new update on when the new fix may be available?

jamiepryer@hotm
03-26-2005, 04:41 PM
helpppppppppppppppppppppppp
not sure what i have done wrong, but need some serious help please!!

for starters i have the following error code on my forum:

Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 2991

Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 2991

Warning: Invalid argument supplied for foreach() in /includes/functions.php on line 2991

http://www.sussexcarz.com/forum/upload/


plus i cant seem to find this anywhere?

*****************************
Add stats to any page and header:
*****************************
In includes/init.php

Find:
*****************************

// add default special templates
$specialtemplates = array_merge(array(
'options',
'cron',
'forumcache',
'usergroupcache',
'stylecache'
), $specialtemplates);

jamiepryer@hotm
03-26-2005, 06:18 PM
this is my forum:

http://www.sussexcarz.com/forum/upload/

dcarr
04-06-2005, 02:07 AM
How could I have the second top poster rather than the top poster shown? As I am admin...I have way more posts than anyone else. I would like to show the actual member with the top posts. Any idea? Thanks.

red_baron2000
04-06-2005, 11:35 PM
Ok, for those of you who have John's Excellent vB3 Arcade hack installed, here's a treat!

This addon will add a line to your Forumhome Stats to Display the Most Played Game (with a link directly to that game), the highest scorer in that game (the Champion) and his score.

Here we go!

In index.php, find:

// <!-- TOP REPUTATION -->
$toprep = $DB_site->query_first("
SELECT userid, username, reputation
FROM " . TABLE_PREFIX . "user
ORDER BY reputation
DESC LIMIT 1
");

BELOW it add:

// <!-- TOP ARCADE GAME -->
$mostactive = $DB_site->query_first("
SELECT COUNT(*) as total, gamesessions.gamename, games.title, games.gameid, MAX(gamesessions.score) as score, user.username, user.userid
FROM ".TABLE_PREFIX."gamesessions
INNER JOIN " . TABLE_PREFIX . "games AS games ON(gamesessions.gamename = games.shortname)
INNER JOIN " . TABLE_PREFIX . "user AS user ON(games.highscorerid = user.userid)
WHERE gamesessions.valid=1
GROUP BY gamesessions.gamename
ORDER BY total
DESC LIMIT 0,1
");

Find:

$statscache['lastupdate'] = intval (TIMENOW);

ABOVE it add:

$statscache['mostactivetotal'] = intval ($mostactive[total]);
$statscache['mostactivegamen'] = $mostactive[gamename];
$statscache['mostactivetitle'] = $mostactive[title];
$statscache['mostactivegameid'] = intval ($mostactive[gameid]);
$statscache['mostactivescore'] = intval ($mostactive[score]);
$statscache['mostactiveun'] = $mostactive[username];
$statscache['mostactiveid'] = intval ($mostactive[userid]);

Find:

$statscache['topreprep'] = vb_number_format($statscache['topreprep']);

BELOW it add:

$statscache['mostactivetotal'] = vb_number_format($statscache['mostactivetotal']);
$statscache['mostactivescore'] = vb_number_format($statscache['mostactivescore']);


Save and upload.

In the forumhome template, find:

<if condition="$show['reputation']">
<tr>
<td nowrap="nowrap"><span class="smallfont">Top Reputation: <a href="member.php?$session[sessionurl]u=$statscache[toprepid]">$statscache[toprepun]</a> (<b>$statscache[topreprep]</b> Reputation Points)</span></td>
</tr>
</if>

BELOW it add:

<tr>
<td nowrap="nowrap"><span class="smallfont">Most Active Arcade Game: <a href="$vboptions/arcade.php?do=play&gameid=$statscache[mostactivegameid]">$statscache[mostactivetitle]</a> (<b>$statscache[mostactivetotal]</b> Total Plays -- Champion: <a href="member.php?$session[sessionurl]u=$statscache[mostactiveid]">$statscache[mostactiveun]</a> with <b>$statscache[mostactivescore]</b> Points)</span></td>
</tr>

Save the template.

NOTE: Don't forget to set the update time to 0 and refresh the page so the cache can get updated with the new stats. And don't forget to set it back to what you had it set at after updating the cache. ;)

You're done!
Enjoy!

any idea how to make it work also with [b]ibproarcade? thank you :)

Mijae
04-06-2005, 11:45 PM
I have an update that fixes all of the percentage problems and is accurate and also has a few more items in it. I just haven't gotten the text file together yet to update it. I will try to get that going here shortly. ;)
Still waiting for the next release :P

Brandon Sheley
05-28-2005, 05:20 AM
installed. had a few bugs, but with some searching i was able to figure things out :) thank you for the mod

red_baron2000
05-29-2005, 05:18 PM
on forum stats it show on my forum i have 1002 total registred members so far so good ..but then it show also 700 active members and 302 not active! my questions are :

1) how do i know who those innactive members are?
2) how does the hack assig"innactive to a member?" is there some settings in the acp or php files?
3) is it possible to desable this feature if yes then how?

thank you very much for the help .

Boofo
05-29-2005, 05:24 PM
on forum stats it show on my forum i have 1002 total registred members so far so good ..but then it show also 700 active members and 302 not active! my questions are :

1) how do i know who those innactive members are?
2) how does the hack assig"innactive to a member?" is there some settings in the acp or php files?
3) is it possible to desable this feature if yes then how?


thank you very much for the help .

The inactive members are members you have deleted from your site for whatever reason. The active members are the actual members you have.

red_baron2000
05-29-2005, 09:44 PM
is there a way to desactivate it? it is somehow confusing? thank you :)

Boofo
05-30-2005, 05:09 AM
is there a way to desactivate it? it is somehow confusing? thank you :)

It's not confusing at all.

Just don't enter the code for that in the template if you don't want it to show.

Vindicare
08-07-2005, 04:19 PM
Any chance of a 3.5 release for this?

I was a great fan of this hack, but it doesn't (seem to) work with 3.5 anymore.

Boofo
08-07-2005, 04:22 PM
Any chance of a 3.5 release for this?

I was a great fan of this hack, but it doesn't (seem to) work with 3.5 anymore.

Yes, there is a version being worked on now. ;)

iiyoN
08-16-2005, 01:04 PM
Hi , I installed the hack and got the percentages right

$statscache['topposterpercent'] = round(100 *($topposter[posts] / $totalp), 2);
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 2);

worked fine for me.

but one small thing is weird .. i changed into debug mode , added new setting - but only 3 blank options appeared , so i wasn't able to fill in all things mentioned in the install text.
thus I have a problem in the vbulletin options. The "forum home stats cache update" setting shows up without info - can't change the update time.

would be nice if anyone could tell me if this could be solved.
it's just a minor thing cause everything else works fine.
Update time is set to 10 by default and the date and time showing up in the stats is correct.

regards
iiyoN

loonytune15
08-30-2005, 04:04 PM
g'day was wondering if the update for this hack was ready yet? Or was it released elsewhere and i missed it?

dreck
10-09-2005, 11:43 PM
Yes, there is a version being worked on now. ;)Cool, you are the man!

Thanks, dreck

weitalia
12-29-2005, 06:47 PM
Yes, there is a version being worked on now. ;)
So we'll wait ;) Great man!

;)

Thug
12-30-2005, 12:32 AM
hi i want to uninstall this hack ive done all template edits n php ones,but how do i remove the queries