View Full Version : vB3 Forumhome Stats Cache Serialize hack v2.2
Boofo
02-10-2004, 10:00 PM
vB3 Forumhome Stats Cache Serialize hack
Version 2.2
(By Boofo)
What does this hack do?
This hack will add some forum statistics to your forumhome that will be cached (to reduce the query load) for a certain amount of time that can be set to whatever you want. This covers most of the stats any forum Admin would use on his site.
Note: This is the setting for the time interval (in minutes) that you want the cache to be updated on. The default value is 10 minutes. The following code is in the index.php part of this hack.
$updatetime = 10;
Once you install the Admin CP setting (at the end of this file), you will be able to update this from the Admin CP vBulletin Options settings.
Credits:
I want to thank Tigga for the original Forumhome Statistics Cache hack for vB2, partly on what this hack is based. I also want to thank EvilLS1 for his time and patience in helping put this hack together. Another thank you goes out to Mike Gaidin for testing this thoroughly while I was putting together this install file. And, finally, thank you goes out to NTLDR, for helping me track down a very stupid mistake on my part which I had overlooked. ;)
Version 2.0 credits go out to g-force2k2 for getting me started on the datastore version of this hack and guiding me through some of the rough parts in the beginning. And also to KirbyDE for answering all of my dummy questions while writing this version and verifying the code when I figured out all of my mistakes. This is my first attempt at using the datastore function but it seems to work better and be easier to code than the older way of doing things. ;)
Version Information:
Version 1.0 --Initial release
Version 2.0 --Completely rewritten using the datastore function for vB3. It now uses "serialize" to store the data and "unserialize" to retrieve the data. There is also now 1 less query when reading from the cache.
Version 2.1 --Combined the "new threads since last visit" and "new posts since last visit" queries into 1 query, thus eliminating another query on cache hits. Thanks goes out to g_force2k2 for this one. ;) Also added Admin CP setting code so you can change the time interval between cache updates via the Forum Display Option setting in the vBulletin Option in the Admin CP. That code to add is at the end of this file.
Version 2.2 --Added "Top Reputation" statistic (requested by rinkrat ) and totally re-did the template. It looks cleaner now.
New Installation:
Do all of the steps in this file.
To Update Version 1.0 to Version 2.0:
To update this hack you will need to do everything in this file over again except the second query (Query #2). After you have this hack up and running again and you have made sure it is running to your satisfaction, you can drop the statscache table (from version one of this hack) completely. It is no longer needed.
To Update Version 2.0 to Version 2.1:
You will need to re-add the code for the index.php and go to the end of this file and add the setting for the Admin CP.
To Update Version 2.1 to Version 2.2:
You will need to re-add the code for the index.php and replace the code for the forumhome template.
Installation overview:
Queries to run: (2)
Files to edit: (2)
--index.php
--member.php
Templates to edit: (1)
--forumhome
Settings to add: (1)
--forumhomecachetime
vB3 Arcade hack stats addon:
https://vborg.vbsupport.ru/showpost.php?p=497075&postcount=262
The first attachment shows the Guest loggedin and the second attachment show the Registered Member and above loggedin.
Scrub
02-11-2004, 04:45 AM
Awsome. :)
Allan
02-11-2004, 09:50 AM
Good bad ..
Thank Boofo ;)
Boofo
02-11-2004, 10:01 AM
What does Good Bad mean?
You forgot the install button here, too. ;)
Allan
02-11-2004, 10:07 AM
oupss, I wanted to say, pretty work, you it is to it well :D
yes, I click ILLIKO ;)
Natch
02-11-2004, 10:34 AM
Sweet work Boofo - clean and simple :)
NyCwill
02-11-2004, 12:05 PM
sweet hack :)
g-force2k2
02-11-2004, 12:19 PM
Nice work Boofo, just some ideas for future vb3 stats hack, I would personally have used a datastore column instead of a new table ( special template ) and also would have used a cron job, but these are just some ideas. Nonetheless good work Boofo.
Cheers,
g-force2k2
Boofo
02-11-2004, 12:21 PM
Nice work Boofo, just some ideas for future vb3 stats hack, I would personally have used a datastore column instead of a new table ( special template ) and also would have used a cron job, but these are just some ideas. Nonetheless good work Boofo.
Cheers,
g-force2k2
Maybe we can get together and you can show me what you mean. The datastore is new to me. The cron job, I thought about but I wasn't sure I really needed to go that route. That is new to me in vB3, also. ;)
gmarik
02-11-2004, 06:18 PM
Why this looks nice. Could add latest attachment as an option as well ...
Gio Takahashi
02-11-2004, 07:08 PM
Will install! Good job.
Mike Gaidin
02-11-2004, 08:19 PM
Nice one Bob. Glad to see you finally released it. :)
* Mike Gaidin clicks install.
rinkrat
02-11-2004, 08:57 PM
Can it say Top Reputation?
Boofo
02-12-2004, 12:10 AM
You can add whatever you want to it. The possibilities are endless. ;)
Boofo
02-12-2004, 07:41 PM
Ok, all you query junkies! ;) New version uploaded to first post. One more query deleted from this hack. Now uses serialize to store the data. ;)
Mike Gaidin
02-12-2004, 08:50 PM
Upgraded. Good job Bob. :)
Boofo
02-12-2004, 09:15 PM
Thanks, Mike! ;)
Alien
02-13-2004, 03:05 AM
You can add whatever you want to it. The possibilities are endless. ;)
Awesome work. How do the queries work overall? I understand it just grabs data at intervals or whatever, but after it does and someone loads the forumhome how many queries max extra are they running at that particular moment? :) Just curious!
* Alien clicks install.
Boofo
02-13-2004, 03:20 AM
This hack will add 1 query to what you already have (for the new threads and new posts since you last logged on). This can't be cached because it is per user. If you have 10 you will now have 11 when reading from the cache. Since the cache is serialized, there is no query there. So the update to the hack dropped one query. When it updates the cache, it will add 9 queries for all of the stats being updated. So you would then have 20 queries. But the 20 queries only runs at whatever interval you have set (default is 10 minutes). Once the cache is updated, you are back down to 11 queries until the next update. This way you can have numerous stats on your forumhome and not have to worry about a lot of server load at all times. With the serialzation, you can use these same stats on other ares of the board by just including the statscache in the special templates section of the file you want to use them in and you won't have you worry about any queries there (if I understand serialization, right, anyway). ;)
Does that help to understand this a little better. ;)
Mike Gaidin
02-15-2004, 09:00 PM
Nice addition to the latest version Bob. :)
Moosehunter
02-24-2004, 09:21 PM
I have a vbrc3 tables prefix that i edited it to the queries. Now i get this message:
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
Is there anything to edit to get rid of this message?
Boofo
02-24-2004, 09:46 PM
Try this:
$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
");
Moosehunter
02-24-2004, 10:55 PM
Thanks for the quick reply. That never worked. So i took that whole referrer thing out and it is now working. I do not use the referer system anyways. Once again boofo thanks for the quick reply.
Boofo
02-24-2004, 11:20 PM
That's strange. Optimize your tables in the Admin CP and try it again. There is no way that that shouldn't work unless you have a table a little messed up.
No problem on the reply. I just try to support my hacks as best I can. ;)
Don't forget to click install. ;)
Steve123
03-04-2004, 10:40 AM
Hey Boofo thanks for the hack :)..
To tell you the truth i was thinking of making something like this a few days ago (with my limited php knowlege tho) hehe..
With my header i display total posts, members and threads on the forum.
Instead of adding statscache to every file (pain in the ass) i was thinking maybe adding that code (main code) to the phpinclude or even trying to add statscache to the specialtemplates using the phpinclude (possible?), im not to sure with this new vb3 where the phpincludes comes into play so yeh dunno if it would be possible...(havnt had time to look)
What do you guys and gals think?
Thanks
Boofo
03-04-2004, 10:49 AM
I would leave it on the forumhome. You'd be adding a lot of unneccessay queries when the cache updates to all of your pages. ;)
But if you wanted to add the stats themselves to different pages and have the forumhome updated them as needed, then all you have the do is add $statscache to the specialtemplates of whatever page you want them on and do un unserialize and it would do no queries that way. ;)
Steve123
03-04-2004, 10:59 AM
I would perfer it to be on the header, same way as i had it on vb2... (used to it now hehe)
The only parts i use are total threads, posts and members. Ive edited the rest out of your script.
I was going to set it to update every 20mins, therefor it would only run thoes 3-4 queries every 20mins, which isent so bad considering they are only quick ones..
im just trying to think of the best way of doing it ?.
Wow you do reply fast ;)
Steve123
03-04-2004, 11:00 AM
==================
thats good and all, but if its in my header.. well thats alot of files.. hehe
Boofo
03-04-2004, 11:07 AM
Give it a shot and let me know how it goes. I've never tried doing it that way before. ;)
If I was going to add it to my header, I would run the hack on the forumhome and let it do all of the updating and then just unserialize it. But to tell you the truth, I'm not sure what file I would have to do that in. Maybe init.php?
Steve123
03-04-2004, 11:21 AM
yeh ill give it a go, im just rebuilding my forums atm (upgrading to vb3)...
Still tho, what i mite do is make it so it just updates on forumhome and thats it..
But how would i add statscache to the specialtemplate files without editing all the .php files by them selfs..
Just worked a 13hour shift and havnt used php for a while now, kinda forgot..(brains dead)
im sure its something like, (add to phpinclude)
$specialtemplate = ."',statscache'";
i think? heh..
Boofo
03-04-2004, 05:03 PM
I'm not sure. I've never tried doing it like that. Let me know what you find out and if it works, I'll add it to the instructions. ;)
Ky Kiske
03-04-2004, 06:37 PM
Rock On...I have been looking for this *installs*
djohn
03-04-2004, 08:51 PM
Hello, i'd like to install this hack, but i don't need some of it's features, such as Top Referer, and most viewed profile. Is there a way to not to add them without using up the db queries? Also, could you please add a feature to show how many threads new messages were created in since your last visit? For example, instead of "There have been 1 new post since your last visit" it would say" There have been 6 new posts in 2 threads since your last visit. Would greatly appreciate that feature.
Boofo
03-04-2004, 09:55 PM
Hello, i'd like to install this hack, but i don't need some of it's features, such as Top Referer, and most viewed profile. Is there a way to not to add them without using up the db queries? Also, could you please add a feature to show how many threads new messages were created in since your last visit? For example, instead of "There have been 1 new post since your last visit" it would say" There have been 6 new posts in 2 threads since your last visit. Would greatly appreciate that feature.
The new threads and posts since your last visit is already installed in this hack. But I do it as new posts and new threads since your last visit.
As far as taking out what you don't need, that is easy. Just take out the queries and the statscache variables for them and it shouled work fine.
Steve123
03-05-2004, 12:33 AM
Hey Boofo
I think ive figured it out, had a good night sleep so my brain is awake again.. hah..
=====
Add stats to any page and header
OPEN: includes/init.php
FIND:
// add default special templates
$specialtemplates = array_merge(array(
'options',
'cron',
'forumcache',
'usergroupcache',
'stylecache'
), $specialtemplates);
REPLACE
// add default special templates
$specialtemplates = array_merge(array(
'options',
'cron',
'forumcache',
'usergroupcache',
'stylecache',
'statscache'
), $specialtemplates);
Edit Template PHPINCLUDE
ADD:
$statscache = unserialize($datastore['statscache']);
================
It seems to be working, this will only update on forumhome but you can use the $statscache vars on any template with no extra queries.
(will work out a good way to make it update every 10mins no matter what page later on)
Boofo
03-05-2004, 12:55 AM
I see my initial guess of the init.php was correct. ;)
As long as the board is fairly busy, even with guests, it should be ok updating on the forumhome. Can you post a screenshot of the stats in the header? I would like to seee how you've made it look. I might do this myself. ;)
Steve123
03-05-2004, 02:09 AM
Keep in mind that i am in the process of upgrading to vb3 from vb2.
This is what ive done so far..
Boofo
03-05-2004, 02:15 AM
Looks good. You moved the navbar into the header, right? Maybe you can help me to do that? ;)
Steve123
03-05-2004, 02:29 AM
Yeh, i didn't like the navbar where it was..
So i cut the menu out of the navbar and stuck it there.. easy as that :).. no coding needed.
Ive made my own little welcome panel, like the one in vb2 for my forum home, then just had a small little navbar for the rest of the forum.. (shows where u are) and flashes with new pm if u have a new pm.. :)
Boofo
03-05-2004, 02:38 AM
You ought to release your version of the welcome panel. Sounds interesting. PM me with the code, if you don't mind. I'd like to take a look at it. ;)
Steve123
03-05-2004, 02:49 AM
Im in the process of making it atm, its just taking me a while because i want to make it with hardly any queries... Plus im doing it in my spare time at work(which is not much)..
Ill show you the code when im done, its based on Welcome Panel 1.2 Hack by Hwulex (Credit to him)
Altho ive changed just about everything he done, got the idea from him.
Mostly you add this to index.php
$indexpage = true;
Then edit navbar with
<if condition="$indexpage">
Welcome Panel here
</if>
<if condition="!$indexpage">
Normal Navbar stuff here
</if>
When its a bit more finished and ive understand more of vb3's code u can have a look :)
Boofo
03-05-2004, 04:45 AM
I'll be looking forward to it. ;)
djohn
03-05-2004, 07:48 AM
Boofo, thanks! I think i've done what i wanted, the lines are not there, and i've deleted the query lines as well. I just have one question left. DO the lines saying the number of new posts/threads since my last visit automatically get hidden it there weren't any new posts/threads? First time I've loaded the page the lines simply were not there!
Boofo
03-05-2004, 08:15 AM
Yes, they won't show up unless there are new posts or new threads since your last visit. ;)
Don't forget the install button. I am going to be doing an update to this shortly and you will want to be notified when that happens.
hXc Radio
03-05-2004, 12:06 PM
this installed very nicely on RC4! Everything shows, but one part of instructions I could not figure out was
Turn on DEBUG and go to the Admin CP > vBulletin Options
Add New Setting:
How do I turn on debug and under vb options there is no add link only the current settings to edit. Also once you explain how, do I turn debug back off after I add the new settings?
Boofo
03-05-2004, 12:48 PM
Add
$debug = '1';
to the end of /includes/config.php (But before the ?>)
Just make sure you take it out after you have added the setting for the hack. ;)
Boofo
03-08-2004, 06:26 AM
Thanks for the quick reply. That never worked. So i took that whole referrer thing out and it is now working. I do not use the referer system anyways. Once again boofo thanks for the quick reply.
I think I know why the referrer query never worked for you. If you don't have referrers enabled, then there is nothing to find with the query. I need to make a note of that in the install file. Thank you for bringing this to my attention. ;)
hXc Radio
03-09-2004, 01:13 AM
Thought you might like to see how I worked this into the nav.. Love the hack! good job!! ;)
Boofo
03-09-2004, 01:21 AM
Looks excellent! Can I get the navbar code for that? Also, where did you put the navbar links at?
Did you use the init.php for the specialtemplates? I did that but every once in a while the stats show up empty when I go to a page. Has that happened to you yet?
hXc Radio
03-09-2004, 03:18 AM
sure PM me your e-mail addy and I'll send you it. I don't want to release my add-on yet as the shoutcast part is still buggy, if amazon is busy, it lags the site load. So I want to develope it to get the album cover of current song locally via mysql.
Steve123
03-13-2004, 11:16 AM
Hey Bofo ive just about finished my forumhome "look"..... with my own welcome panel etc.. that u wanted to see..
Sorry for late reply, been busy porting my party hack into vb3.. (lets u nonimate what forum is an event type thing, then the users have the option of sayin they are attending this event, auto generates timetable and party info etc... ).
God damn the code has changed alot, took me a while to figure it all out.. vb3 code that is..
anyways if u want that code.. just pm me...
sabret00the
03-23-2004, 09:30 AM
i'm running the top X stats hack, does this conflict at all?
Boofo
03-23-2004, 09:36 AM
I don't know that hack but I wouldn't think there should be any problem with running them both. ;)
I don't know that hack but I wouldn't think there should be any problem with running them both. ;)
I have a problem with this hack. It shows me as topposter a user that a) is not registered anymore and b) who can't be by any chance topposter. On top I know the topposter from before upgrading. I had another hack installed which worked.
Buttom Line is: The topposter which shows up is not correct. Could you take a look into that? Thanks. :)
Besides, awesome hack! *clicks install*
Boofo
03-23-2004, 06:38 PM
Could you let me see the hack you had installed that you said worked before? The top poster in this hack is accurate. Since it pulls the top poster info from the user table, the person has to be registered or they wouldn't show up as top poster. They couldn't. If a top poster posts enough before they leave, it will show up until someone else surpasses that top poster mark, as long as they have an account on your site.
Could you let me see the hack you had installed that you said worked before? The top poster in this hack is accurate. Since it pulls the top poster info from the user table, the person has to be registered or they wouldn't show up as top poster. They couldn't. If a top poster posts enough before they leave, it will show up until someone else surpasses that top poster mark, as long as they have an account on your site.
I really can't remember which hack it was. All I know is, I downloaded it here for vB2.
If you want, take a look on my site:
http://www.spassforen.de/forum/index.php?
There's another glitch I found, which could result from the language settings. (Don't know, if that causes the issue i described first, too): The top_poster_'s id in the link to the member profile uses a "." in it, which results in showing an error by clicking on the name.
I forgot to mention that: You do NOT have to register on my site. Just use username test and password test. I don't want somebody to get the wrong impression here. :)
Boofo
03-23-2004, 07:54 PM
Ok, I checked your site out and the Top Poster code IS working. I went into your Member's List and clicked the arrow for the Posts column and the Top Poster is the same as the one that shows on the forumhome.
As far as the problem with the userid link for the name, that is a language issue, it almost has to be. Post the piece of code here for the userid and I will look at it and see if we can help you get it fixed. ;)
Ok, I checked your site out and the Top Poster code IS working. I went into your Member's List and clicked the arrow for the Posts column and the Top Poster is the same as the one that shows on the forumhome.
As far as the problem with the userid link for the name, that is a language issue, it almost has to be. Post the piece of code here for the userid and I will look at it and see if we can help you get it fixed. ;)
Ok, there is some kind of missunderstanding. The number of posts and the name for the topPOSTER is fine. But the name of the top_THREADSTARTER is not correct. This user like I said is not a member anymore, his link to the profile takes me to an error page. Did you try to set your language to "Deutsch"? Because the user "test" has english as default language.
Try to get the piece of code out now...
wrongful
03-23-2004, 10:50 PM
I seem to be having some major problems with this hack.
First, the total registrations count is more than double what my actual registrations are. Also, how are active members calculated as opposed to people who are a part of the total registrations, and can this be modified. Also, my top referer isn't showing up as you can see in this screenshot. I am using vB3 Gold if that makes any difference.
Ok, here is the piece of code// <!-- TOP POSTER -->
$topposter = $DB_site->query_first("
SELECT username,posts,userid
FROM " . TABLE_PREFIX . "user
ORDER BY posts
DESC LIMIT 1
");
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
"); At least I think it is...
BTW, I tried to set my lanuage to english but even though, the link to the members profile is still wrong. The link doesn't show up like:
www.forum.url/forum/member.php?u=3512
it shows like:
www.forum.url/forum/member.php?u=3,512 (<-- see the comma?)
When I turn it back to german, I have a dot there instead of the comma, which is the german separator for a thousand.
This also happens with topposter, Most Viewed Profile and Top Referrer. With the welcome newest member it is fine. In both languages.
Boofo
03-23-2004, 11:27 PM
Ok, change this query:
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
");
to this:
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
WHERE postuserid <> 0
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
");
As far as the uderids going to an error page, delete the following from the index.php:
$statscache['topposterid'] = vb_number_format($statscache['topposterid']);
$statscache['topstartid'] = vb_number_format($statscache['topstartid']);
$statscache['getfileviewsid'] = vb_number_format($statscache['getfileviewsid']);
$statscache['topreferrerid'] = vb_number_format($statscache['topreferrerid']);
$statscache['toprepid'] = vb_number_format($statscache['toprepid']);
I forgot to take that code out when I released the hack. Sorry about that. That should fix everything. Let me know for sure.
Boofo
03-23-2004, 11:35 PM
I seem to be having some major problems with this hack.
First, the total registrations count is more than double what my actual registrations are. Also, how are active members calculated as opposed to people who are a part of the total registrations, and can this be modified. Also, my top referer isn't showing up as you can see in this screenshot. I am using vB3 Gold if that makes any difference.
Support is only being provided to those who click the install button. That is something that is being ignored on this site and needs to be taken care of by anyone who installs the hacks made here. I hope you can understand.
wrongful
03-23-2004, 11:39 PM
Support is only being provided to those who click the install button. That is something that is being ignored on this site and needs to be taken care of by anyone who installs the hacks made here. I hope you can understand.Ok I didn't click it initially because it wasn't working right and I normally don't click install until I have a hack completely working, but if you insist.
Boofo
03-23-2004, 11:54 PM
Thank you. ;)
Ok, the Total Registrations are the total regsitrations you have EVER had on your board. When you delete accounts for whatever reason, the Active Registrations are what is left. That is the ACTUAL number of memebers on your site. Does that make any sense. ;)
As far as the userids not being correct, follow the instructions above and delete those lines and when the next cache update is run, it should straighten everything out for the userids.
Also, make sure you have the referrer sysem enabled in the Admin CP. If it is, then you missed a piece of code when installing the hack. Look at the spot where the name should be in the code and tell me what is there right now.
Ok, change this query:
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
");
to this:
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
WHERE postuserid <> 0
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
");
As far as the uderids going to an error page, delete the following from the index.php:
$statscache['topposterid'] = vb_number_format($statscache['topposterid']);
$statscache['topstartid'] = vb_number_format($statscache['topstartid']);
$statscache['getfileviewsid'] = vb_number_format($statscache['getfileviewsid']);
$statscache['topreferrerid'] = vb_number_format($statscache['topreferrerid']);
$statscache['toprepid'] = vb_number_format($statscache['toprepid']);
I forgot to take that code out when I released the hack. Sorry about that. That should fix everything. Let me know for sure.
Now I get this:Database error in vBulletin 3.0.0:
Invalid SQL:
SELECT COUNT(*) AS count,postuserid,postusername
FROM thread
WHERE usergroupid IN (2,5,6,7)
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
mysql error: Unknown column 'usergroupid' in 'where clause'
mysql error number: 1054
Date: Wednesday 24th of March 2004 03:03:48 AM
Script: http://www.spassforen.de/forum/index.php?
Username: Alex
IP Address: xxx.xxx.xxx.xxx
Boofo
03-24-2004, 12:04 AM
Ok, redo the code with the query from the post above again (you will notice it is different now). I had to change it and you had already re-done it before the post edit. Sorry about that. ;)
Ok, redo the code with the query from the post above again (you will notice it is different now). I had to change it and you had already re-done it before the post edit. Sorry about that. ;)
lol... ok, mom ;)
Now we're talking. Thanx dude! :) Oh, and if you have a minute, phrasing all that stuff into the vB's Phrase System would be nice. I do that one now on my own.
Thanks again! :)
Boofo
03-24-2004, 12:16 AM
Did the new query get rid of the Top thread Starter that is no longer a member of your site?
Also, if you want to, you can send me what you did for the phrase system and I can incorporate it into the hack and give you full credit for it. ;)
Did the new query get rid of the Top thread Starter that is no longer a member of your site?
Also, if you want to, you can send me what you did for the phrase system and I can incorporate it into the hack and give you full credit for it. ;)
I could do it, just can't promise you when, because I have a lot of personal stuff going on right now. Ah, what the hell... I try to put it together tomorrow. ;)
Boofo
03-24-2004, 03:14 AM
I was just giving you a hard time. ;)
If you find the time, I will add it gladly. If you are too busy, I can do it sometime soon. ;)
And thank you. ;)
I was just giving you a hard time. ;)
If you find the time, I will add it gladly. If you are too busy, I can do it sometime soon. ;)
And thank you. ;)
I've updated the instructions now. Everything is included in the vB phrase system now. PLUS I applied your above fixes, too. The only thing I couldn't do was a script to insert the new phrases automatically. Maybe you want to take a look at it, because there are quiet a few new phrases which have to be inserted manually now.
If you want to take a look at it first to see, if you can write a little script to insert the new phrases automatically I would say you give me your eMail address so I can send it to you. If you are not writing a script should I just attach it here, or do you want to have the updated instructions by eMail anyway?
EDIT: And I found a little glitch with $newuserid. That needs to be vb_number_formated, too. Also in the instructions.
Boofo
03-25-2004, 01:47 AM
I'll pm you my email and you can send it there. I will update the hack and credit you accordingly. How does that sound? ;)
And thank you, sir. ;)
No, thank you! You got mail... :)
Boofo
03-25-2004, 02:15 AM
I've got mail! ;)
Everything looks great! Thank you. ;)
The only thing is the newuserid can't be done with the number format or we run into the same rpoblem as the others we fixed yesterday. Anyone over 1000 on there userid would get commas for English and persions for German. that was what was messing up the other userids. I has them doing the number format, until you caught that. On my site, I only have about 30 plus users so I wouldn't have caught that for qwuite a while, I'm afraid. ;)
I will get the install file edited and the first post updated with it here shortly. Thank you again for the help in catching my stupid mistakes and with the phrases. ;)
Stop by my site and I will have something special for you, if you are interested. ;)
Actually, the way I edited it, it works fine. ;) Check out my site, works there, too.
Boofo
03-25-2004, 02:32 AM
But with the number format, this:
www.forum.url/forum/member.php?u=3512
would become this:
www.forum.url/forum/member.php?u=3,512
;)
I've got mail! ;)
Everything looks great! Thank you. ;)
The only thing is the newuserid can't be done with the number format or we run into the same rpoblem as the others we fixed yesterday. Anyone over 1000 on there userid would get commas for English and persions for German. that was what was messing up the other userids. I has them doing the number format, until you caught that. On my site, I only have about 30 plus users so I wouldn't have caught that for qwuite a while, I'm afraid. ;)
I will get the install file edited and the first post updated with it here shortly. Thank you again for the help in catching my stupid mistakes and with the phrases. ;)
Stop by my site and I will have something special for you, if you are interested. ;)
Stopped by, registered, but... duh! Where? What? Who? :D
Ah, got it.... nice one. So that means, there will be a version 3.0? :D
BTW, while I am browsing your forums. Which "Who was online today"-Hack do you use? I like it with keeping the most ever users online today.
Next one I would be very interested in is the XXX's Private Forum. Is that just done by using the [you] hack, or is there anything else to it?
Boofo
03-25-2004, 03:58 AM
Just the [you] hack is all. It works very well in the forums as you can see. Although, I changed [you] to my own special word so the hack does not get abused and used wrongly on my crappy site. ;)
bobjackson
03-25-2004, 11:48 AM
a quick note on the install...
everything went fine except the "Top Referrer" query.
i have a table prefix set, so i had to alter your query. :)
(added "TABLE_PREFIX" on the select list AND the where clause for the "user" table).
// <!-- TOP REFERRER -->
$ref = $DB_site->query_first("
SELECT COUNT(*) AS referrals, " . TABLE_PREFIX . "user.username, " . TABLE_PREFIX . "user.userid
FROM " . TABLE_PREFIX . "user AS users
LEFT JOIN " . TABLE_PREFIX . "user ON (users.referrerid = " . TABLE_PREFIX . "user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 1
");
otherwise...installed fine. :) thanks.
Boofo
03-25-2004, 11:57 AM
You should have only had to add the TABLE_PREFIX on the tables themselves, not the SELECT parts. ;)
But as long as it is installed and working for you, then great! Make sure you make the changes noted above until I get the update for this hack out, though. ;)
bobjackson
03-25-2004, 12:18 PM
You should have only had to add the TABLE_PREFIX on the tables themselves, not the SELECT parts. ;)
But as long as it is installed and working for you, then great! Make sure you make the changes noted above until I get the update for this hack out, though. ;)
well no...as that obviouslly didn't work for me. ;)
"TABLE_PREFIX . user" is seen as a different table than just "user".
it's like saying:
"SELECT A.fieldname FROM tablename B"
A.fieldname does NOT exist in tablename B
in your current sql statement, you're specifying a table that *may not* exist for some members...the "user" table. :)
regardless, i have it installed and i'm good to go!
i only posted that because i saw that another person had this same error. :)
thanks again!
Boofo
03-25-2004, 08:09 PM
in your current sql statement, you're specifying a table that *may not* exist for some members...the "user" table.
If anyone running vBulletin doesn't have a user table, that would definately be a first and impossible, also, I'm afraid. ;)
bobjackson
03-25-2004, 11:06 PM
If anyone running vBulletin doesn't have a user table, that would definately be a first and impossible, also, I'm afraid. ;)
sorry...my post came out wrong.
of course they'd have a user table.
i was trying to point out that they may not have it named [user]; as i run my tables with a prefix. :)
Boofo
03-25-2004, 11:08 PM
Right, and the TABLE_PREFIX in front of the user table should take care of that. ;)
bobjackson
03-25-2004, 11:17 PM
do me a favor...take two minutes and create a new user table with a prefix, then run your query below (replacing TABLE_PREFIX below with the prefix on the newly created table).
it will error out.
#1109 - Unknown table 'user' in field list
merely putting the table prefix in the "from" clause only is not enough.
your query:
// <!-- 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
");
i don't get me wrong here, i'm not trying to give you a hard time. just want to point out that the above string is incorrect when using a table prefix. :)
Boofo
03-25-2004, 11:32 PM
I'll take your word for it since I don't use a table prefix in my db. It's just that that isn't supposed to be how it works from all I've encountered with vB3. If it is doing what you say, then it sounds to me like the vb team needs to do some more work on the TABLE_PREFIX code, don't you think? ;)
bobjackson
03-25-2004, 11:51 PM
na, actually that's SQL thing...nothing to do with vB. ;)
when joining tables, you should specify the TABLE_PREFIX on the table AND field names.
if pulling only ONE table, you do not need the TABLE_PREFIX on the select list, just the table name.
thanks for listening! :D
and GREAT hack btw!
Boofo
03-26-2004, 12:06 AM
I'll have to remember that in the future. Thank you, sir, for informing me of this. It's good to know. ;)
Don't forget to vote for the Hack of the Month for March. This hack is in there. ;)
Mijae
03-26-2004, 12:13 AM
I'll have to remember that in the future. Thank you, sir, for informing me of this. It's good to know. ;)
Don't forget to vote for the Hack of the Month for March. This hack is in there. ;)
Seems like I am the only one who is having style problems? I have a default vB3 template, but the style is messed up!
Check it out at http://www.invoid.net
* Mijae clicks install after posting.
Boofo
03-26-2004, 12:24 AM
Try changing this:
<td colspan="6" nowrap="nowrap"><span class="smallfont">$vbphrase[threads]:
to this:
<td colspan="6" nowrap="nowrap" colspan="2"><span class="smallfont">$vbphrase[threads]:
and let me know if it fixes it.
Mijae
03-26-2004, 12:25 AM
Seems like I am the only one who is having style problems? I have a default vB3 template, but the style is messed up!
Check it out at http://www.invoid.net
* Mijae clicks install after posting.
Also, %'s arent showing up! Hrm!
Boofo
03-26-2004, 12:26 AM
This is what I see:
ivForums Statistics
Mijae
03-26-2004, 12:27 AM
Try changing this:
<td colspan="6" nowrap="nowrap"><span class="smallfont">$vbphrase[threads]:
to this:
<td colspan="6" nowrap="nowrap" colspan="2"><span class="smallfont">$vbphrase[threads]:
and let me know if it fixes it.
Didn't fix it.
Mijae
03-26-2004, 12:29 AM
Here is a SS of what I see:
Boofo
03-26-2004, 12:29 AM
Ok, try this then:
Change:
<td class="panelsurround" align="center">
to:
<td class="panelsurround" align="center" colspan="2">
Boofo
03-26-2004, 12:31 AM
Hang in there, we'll get it. ;)
Mijae
03-26-2004, 12:31 AM
Ok, that fixed the table but it made the image go away :P That doesnt matter tho...
I still see no % and there are some numbers with no text next to them, I am not sure what it should say there? Its in the screenshot.
Boofo
03-26-2004, 12:36 AM
Ok, I intentionally did this so there was no image on the left as the box is long and an image at the top obn the left didn't look right to me. I have all my boxes down there with no images on my site. ;)
Set the update time to 0 and run it a few times and see if that fills those percent areas. Let me know, ok?
Boofo
03-26-2004, 12:39 AM
Also, change that last code I gave you to this and let me know if it still looks ok.
<td class="panelsurround" align="center" colspan="6">
And don't forget to change back the first code I gave you that didn't work. ;)
Mijae
03-26-2004, 12:40 AM
Ok, I intentionally did this so there was no image on the left as the box is long and an image at the top obn the left didn't look right to me. I have all my boxes down there with no images on my site. ;)
Set the update time to 0 and run it a few times and see if that fills those percent areas. Let me know, ok?
Did that, still nothing.
There is no text for Thread Views:, etc. There wasn't anything in the instructions to add phrases, not sure if thats the problem.
Boofo
03-26-2004, 12:42 AM
I don't have the phrase system set up for this yet. All of that is hardcoded. I'll look at it now and get it going for you until I can get the phrase system in place. Ok?
Mijae
03-26-2004, 12:47 AM
I don't have the phrase system set up for this yet. All of that is hardcoded. I'll look at it now and get it going for you until I can get the phrase system in place. Ok?
I re-edited index.php and re-added the template changes and still nothing, no % and no text.
My index.php is unhacked :P
Mijae
03-26-2004, 12:50 AM
$vbphrase[bf2_thread_views]:
Stuff like that isnt showing up :P
Erwin
03-26-2004, 12:53 AM
Very cool hack, Boofo. :)
Mijae
03-26-2004, 01:02 AM
Also, the welcome latest member won't show up!
Damn, your hack messed all my stats :P My forum didnt seem to like the hack altho I did :P
Boofo
03-26-2004, 01:06 AM
Ok, relax. I just uploaded a fixed version to the first post. Clear your cache and re-download it and it should fix ALL of your problems. Let me know. I will stay with you until it is working 100%. That's all I can do except apologize for not looking closer at the file I uploaded the first time. I'm sorry for all the troubles. ;)
Boofo
03-26-2004, 01:08 AM
Very cool hack, Boofo. :)
Thank you, my friend. Coming from you, that means alot to me. After all, I learned alot of coding from you and your hacks. ;)
I just had to re-upload the file because I uploaded the wrong one earlier. It was missing some stuff. Oops! ;)
apokphp
03-26-2004, 01:15 AM
Anyway to exclude members from stats?
Also, it's not working on my site. It's vb3 Gold...no modification to the forumhome template other than yours. Why is it screwy like dat? ;)
Boofo
03-26-2004, 01:16 AM
I'm not sure what you mean.
Mijae
03-26-2004, 01:18 AM
Ha! I knew I had to add some phrases! Wow, I actually saw something wrong :P I have no php knowlegde, so its a big thing for me :P
Everything seems right now, except that the % shows up as 0% for everything.
Also,
$statscache = unserialize($datastore['statscache']);
Do I have to add that to my phpinclude_start if I only use these stats on forumhome?
Edit: also, not sure if its just me or not, but I can't logout now, everytime I click logout and get back to forum index, I am logged in.
Boofo
03-26-2004, 01:21 AM
Anyway to exclude members from stats?
Also, it's not working on my site. It's vb3 Gold...no modification to the forumhome template other than yours. Why is it screwy like dat? ;)
Clear your cache and re-download the file from the first post. I uploaded the wrong one earlier. Sorry about that. ;)
Boofo
03-26-2004, 01:24 AM
Ha! I knew I had to add some phrases! Wow, I actually saw something wrong :P I have no php knowlegde, so its a big thing for me :P
Everything seems right now, except that the % shows up as 0% for everything.
Also,
$statscache = unserialize($datastore['statscache']);
Do I have to add that to my phpinclude_start if I only use these stats on forumhome?
Edit: also, not sure if its just me or not, but I can't logout now, everytime I click logout and get back to forum index, I am logged in.
No, you do not add that for the foumhome. That is only if you want the stats to show up on another page and not have to run any queries. An added bonus, I guess you could say.
The logging out has nothing to do with this hack. Try clearing your cookies and see if that fixes your logging out problem.
Is everything running right or do we need to fix something else?
Mijae
03-26-2004, 01:26 AM
No, you do not add that for the foumhome. That is only if you want the stats to show up on another page and not have to run any queries. An added bonus, I guess you could say.
The logging out has nothing to do with this hack. Try clearing your cookies and see if that fixes your logging out problem.
Is everything running right or do we need to fix something else?
Everything is working fine, except percentages show up as 0%.
My top poster has ~1600 posts and it says 1600 = 0%.
Boofo
03-26-2004, 01:27 AM
Did you set the updatetime to 0 and run it a few times? Try that and let me know. We WILL get it working for you. ;)
Boofo
03-26-2004, 01:33 AM
Ok, I found the problem. I'm a dolt! ;)
Last time, I swear. ;) Re-download the file from the first post (clear your cache first) and re-do the code for the index.php. The percents should show now. ;)
Mijae
03-26-2004, 01:38 AM
Did you set the updatetime to 0 and run it a few times? Try that and let me know. We WILL get it working for you. ;)
Yep, I set it to 0 and tried a few times to see if it fixed, but nope :P
I also updated counters and stuff like that, didn't help.
Boofo
03-26-2004, 01:41 AM
Read my message above your last message. ;)
* Boofo ducks!
Mijae
03-26-2004, 01:49 AM
Read my message above your last message. ;)
* Boofo ducks!
Seems to work now, but...
Top Poster: Raziel Darkeyes (1,646 Posts = 8,230%)
Top Thread Starter: Raziel Darkeyes (153 Threads = 15,300%)
Some users can get mistaken by that, not sure if its ment to show the last 3 decimals or it thinks that 153 threads out of 1200 is 15300% :P
Boofo
03-26-2004, 01:59 AM
Woah! that shouldn't be doing that. It works fine on my site. Set up a test account so I can log on and see the full stats.
Mijae
03-26-2004, 02:05 AM
User: Test Dummy
Pass: test
Boofo
03-26-2004, 02:18 AM
I'm not sure what is going on with the percentages on your site. I am going to have to look at it further and figure out what to do. The code should work for bigger numbers the same as it does for smaller numbers.
You can go ahead and take out the code for percentages for now if you want until I can figure it out. It doesn't make sense why it isn't working, though. Apparently, the threads and posts being that big of a number must make the percentage code do something wierd.
I'll let you know when I have something for you to test (since my baord is so small). ;)
Mijae
03-26-2004, 02:23 AM
No problem, its still an excellent hack :D
It sure got my vote for HoTM :P
Boofo
03-26-2004, 02:25 AM
Thank you, sir. ;)
And I WILL figure out what is going on and supply a fix for it, somehow. ;)
apokphp
03-26-2004, 02:27 AM
What about excluding certain members from being in the stats? For example...I own the site, as such, I have significantly more posts and other stats, than my members. I prefer this to be something more for my members, and I wish to be excluded from showing up in the stats. How can I do that?
Boofo
03-26-2004, 02:38 AM
What about excluding certain members from being in the stats? For example...I own the site, as such, I have significantly more posts and other stats, than my members. I prefer this to be something more for my members, and I wish to be excluded from showing up in the stats. How can I do that?
I do the same thing on my site. ;)
Let me know what stats you want to be excluded from and I can give you the code to do it. ;)
apokphp
03-26-2004, 02:53 AM
I don't get it. It removed the Who's Online area instead of the old stats area. Also, I get funky decimal percentages, and the name of the community doesn't appear. Just using the default, unhacked FORUMHOME template, the code you say to replace, does not exist. It is similar, but it is not exact.
You can login to see what I'm talking about here:
www.onlinedebate.net/forums/
User: llama
pass: llama
Also, as far as excluding members...isn't there a way to go by userid? I'd just prefer to remove myself AND my forumbot from all possible stats.
Boofo
03-26-2004, 03:06 AM
Ok, show me the default code for that area and I will see what I can do to fix it for you. I was using the code from RC3 so it may be different in vB 3 Gold.
Tne percentages seem to have problems with larger thread counts than I have on my board, for some reason. Take the percentage code out for now until I can figure out a way to fix it.
Do you want to excluded from ALL stats or just certain ones?
apokphp
03-26-2004, 03:19 AM
Ahhh...that's gotta be it. I assumed this was for vb3 GOLD.
Here is the code:
<!-- logged-in users -->
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
<a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
<tr>
<td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td>
<td class="alt1" width="100%">
<div class="smallfont">
<div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
<div>$activeusers</div>
</div>
</td>
</tr>
</tbody>
<!-- end logged-in users -->
</if>
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_stats')"><img id="collapseimg_forumhome_stats" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_stats].gif" alt="" border="0" /></a>
<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">
<tr>
<td class="alt2"><img src="$stylevar[imgdir_misc]/stats.gif" alt="<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>" border="0" /></td>
<td class="alt1">
<div class="smallfont">
<div>$vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
<div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>
</div>
</td>
</tr>
</tbody>
Boofo
03-26-2004, 03:29 AM
I had it right. You just accidentally replaced too much code. Replace this part of it with the stats hack:
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_stats')"><img id="collapseimg_forumhome_stats" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_stats].gif" alt="" border="0" /></a>
<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">
<tr>
<td class="alt2"><img src="$stylevar[imgdir_misc]/stats.gif" alt="<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>" border="0" /></td>
<td class="alt1">
<div class="smallfont">
<div>$vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, $vbphrase[members]: $numbermembers</div>
<div><phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase></div>
</div>
</td>
</tr>
</tbody>
apokphp
03-26-2004, 03:49 AM
That's what I DID replace. I gave you code before this part on purpose (I didn't replace all of that). I provided the additional "What's going on" part of the code.
Boofo
03-26-2004, 03:57 AM
Well, as you can see, this hack doesn't touch the Who's Online code at all, so you must have replaced too much of the code. ;)
Put the template back at the default (or the way it was BEFORE you installed this hack) and try it again with just the code replaced from above. See if that fixes your problem. Let me know.
apokphp
03-26-2004, 03:58 AM
ok, I think I fixed that. ;)
What about excluding users from the stats?
Boofo
03-26-2004, 03:59 AM
Ok, how did you fix it? Do I need to change the instructions again?
Also, like I said above, I need to know which stats you want to be excluded from.
apokphp
03-26-2004, 04:12 AM
How about these:
Top Poster
Top Thread Starter
Top Reputation
As far as fixing...I don't know...it was a copy/paste job. I reset to default, used an html editer so I could compare code, did what I thought I had done in the template system...but it seemed to be correct this time around.
I didn't change any code.
Boofo
03-26-2004, 04:26 AM
Top thread starter, use this instead of the query in the hack:
// <!-- TOP THREAD STARTER -->
$topstarter=$DB_site->query_first("
SELECT COUNT(*) AS count,postuserid,postusername
FROM " . TABLE_PREFIX . "thread
WHERE postuserid <> 0
AND postuserid NOT IN (1)
GROUP BY postuserid
ORDER BY count
DESC LIMIT 1
");
Top Poster, do the same thing with this:
// <!-- TOP POSTER -->
$topposter = $DB_site->query_first("
SELECT username,posts,userid
FROM " . TABLE_PREFIX . "user
WHERE userid NOT IN (1)
ORDER BY posts
DESC LIMIT 1
");
Top reputation, again, do the replace it with:
// <!-- TOP REPUTATION -->
$toprep = $DB_site->query_first("
SELECT userid, username, reputation
FROM " . TABLE_PREFIX . "user
WHERE userid NOT IN (1)
ORDER BY reputation
DESC LIMIT 1
");
If you want to add more userids, just put a comma after the 1 in the code abaove and the userid you want to exclude, like this:
NOT IN (1,2,3,4,5)
;)
apokphp
03-26-2004, 04:32 AM
k, thanks. I'm waiting for it to update...we'll see if it worked. ;)
Also, what about the Title of the block? It says: "%1$s Statistics "
Boofo
03-26-2004, 04:55 AM
Change this:
$vbphrase[x_statistics]
To this:
<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>
for the title. ;)
Top Poster: Owen (4,782 Posts = 8,389.47%)
Top Thread Starter: SSJ3 Goten (214 Threads = 7,133.33%)
Those percentages are a bit too precise for my taste, How do I limit it to 2 decimals?
(http://vxforums.com)
Boofo
03-26-2004, 11:05 AM
LOL I'm working on that. I haven't figured out how to do it yet. I will post it here the second I have it. Until then, just take out the percentage code in the template. ;)
nah, I'll just leave it, as long as I know it will be fixed. So I can tell my members that...
Boofo
03-26-2004, 11:18 AM
I'll get it fixed, somehow, or die trying, anyway. ;)
What dedication! Thats the spirit!
Boofo
03-26-2004, 11:25 AM
LOL I haven't ever had a piece of code beat me yet and I ain't about to let that happen now! ;)
There have been 33,184 visits to this page since January 1st, 2003.
Could you possibly release that as a hack or addon to this?
Boofo
03-26-2004, 03:45 PM
That's a page counter that I've had (seems like) forever. I could probably add the code for that fairly easily. Once I get the percentages code figured out, I will look into getting that added for you. How does that sound, sir? ;)
Sounds great, I am a stats freak, in case you didnt figure that out yet ;)
Boofo
03-26-2004, 04:14 PM
Did you check out my forumdisplay stats hack yet?
Also, you DID vote this hack for hack of the month for March, right? ;)
apokphp
03-26-2004, 05:11 PM
Do you guys get anything out of having your hack be the "hack of the month"? I never understood this.
Also, your change fixed the forum name error. ty ;)
Did you check out my forumdisplay stats hack yet?
Also, you DID vote this hack for hack of the month for March, right? ;)
Wow that forumdisplay thing is cool, I installed it the moment I layed eyes on it.
As for hack of the month, its quite the achievement if out of all the hacks yours gets picked for hack of the month.
lasto
03-26-2004, 09:21 PM
a lot of queries though aint it - won tit bring the forum to a halt this ?
Boofo
03-26-2004, 11:50 PM
No, because the queries aren't hard on the server and they are quick. ;)
Boofo
03-27-2004, 01:02 AM
Do you guys get anything out of having your hack be the "hack of the month"? I never understood this.
Also, your change fixed the forum name error. ty ;)
Not really. It's just a nice recognition for hackers that says "Job well done" and that others appreciate his/her work. ;)
Boofo
03-27-2004, 01:05 AM
Wow that forumdisplay thing is cool, I installed it the moment I layed eyes on it.
As for hack of the month, its quite the achievement if out of all the hacks yours gets picked for hack of the month.
I just released an update to the Forumdisplay Stats hack where the template now matches the one for this hack. ;)
Well, yes and no. Usually it is a real honor to be voted hack of the month but since vB3 Gold just came out, there aren't as many hacks in the running right now so there isn't a lot to choose from. But it would still be nice to win. ;)
Mijae
03-27-2004, 03:54 AM
I just released an update to the Forumdisplay Stats hack where the template now matches the one for this hack. ;)
Well, yes and no. Usually it is a real honor to be voted hack of the month but since vB3 Gold just came out, there aren't as many hacks in the running right now so there isn't a lot to choose from. But it would still be nice to win. ;)
I found a small typo :P
Instead of "since your list visit" it should say "since your last visit" :P
Boofo
03-27-2004, 04:02 AM
I'll fix that, thank you for spotting it. ;)
Boofo
03-27-2004, 08:53 AM
I think we have come up with a fix for the percentage problem, but I need to have someone test it that has a large board. Try this and let me know if it fixes this one percentage. If it does, I will post the rest of the fix for this.
In Index.php
Find:
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 2);
and replace it with:
$statscache['topthreadspercent'] = sprintf("%.2f",(100*$topstarter[count] / $totalthreads));
Find:
if (($statscache['topthreadspercent'] % 10) == 0)
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent']) . '%';
else
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
and replace it with:
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
Let me know how it goes. ;)
Mijae
03-27-2004, 01:43 PM
It still says 155 threads is 15500% :P
Boofo
03-27-2004, 01:49 PM
Ok, try taking this completely out and let me know what it does.
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
Mijae
03-27-2004, 02:36 PM
Did nothing...
What I noticed tho is that the part that says "There has been X posts since your last visit" part dissapeared.
Edit: I edited index.php again, and readded the template, but the above part still won't show up. I dont know whats wrong.
the percentages in your forumdisplay hack seem to be fine, whats different about these?
Boofo
03-27-2004, 02:50 PM
Did nothing...
What I noticed tho is that the part that says "There has been X posts since your last visit" part dissapeared.
Edit: I edited index.php again, and readded the template, but the above part still won't show up. I dont know whats wrong.
This code for the percentages has nothing to do with that. That will only show up if there have been new posts since your last visit to the board. Check the code in the index.php file to make sure you didn't do anything there when testing the percentage code.
Boofo
03-27-2004, 02:54 PM
the percentages in your forumdisplay hack seem to be fine, whats different about these?
Believe it or not, they are the same code. ;)
Ok, if you want to try something, i "may" have stumbled on to a fix. let's cross our fingers and try this again. ;)
Replace:
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 2);
with:
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100, 2) . '%';
and take out:
if (($statscache['topthreadspercent'] % 10) == 0)
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent']) . '%';
else
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
You will have to set the update time to 0 and refresh the stats. Do it once or twice and see if that fixes our problem. Let me know as soon as possible so i can either bang my head against the wall or post the rest of the fixes. ;)
Mijae
03-27-2004, 03:04 PM
Nope, it refuses to change :-\ Still says 15500% :(
Mijae
03-27-2004, 03:06 PM
Also, the stuff that dissapeared wont come back, I've rehacked several times now and it still wont show up!
Boofo
03-27-2004, 03:13 PM
Did you write this before or after the pm you just sent me?
Mijae
03-27-2004, 03:20 PM
Did you write this before or after the pm you just sent me?
Before.
maggie
03-27-2004, 07:22 PM
Thanks, Boofo! :D
Boofo
03-27-2004, 07:36 PM
You're very welcome there, young lady. ;)
calvinnguyen
03-27-2004, 07:47 PM
where I can inster Query to run it when execute SQL queries from Admin CP can't run it. I don't know why I didn't have option to run it when I own my server.
Boofo
03-27-2004, 07:56 PM
Have you tried to run the first query from the admin CP? It will run just fine there. ;)
djohn
03-28-2004, 09:02 AM
How can I add the "There have been X visits to this page since ***" to my stats?
Also, is there a way to get back the cell on the left with the stats.gif image? I tried doing it myself, but the tables got all messed up.
djohn
03-28-2004, 09:10 AM
There's also a bug in the way that opera displaye the stats tables. See the screenshot.
The top tables is Currently Active Users, the middle one is the stats table after installing your hack, and the bottom one is the Latest Threads hack table.
Boofo
03-28-2004, 09:16 AM
Ok, try changing the colspan for the hack to 5 and see if that fixes it.
djohn
03-28-2004, 09:20 AM
In fact, the tables got a little bit more messed up (both IE and Opera). See another screenshot. Some line appeared at the bottom of the stats block, that wasn't there before, also, how can i decrease the width between the title of the stats block, and the actual stats block?
See screenshot
djohn
03-28-2004, 09:22 AM
Nope, didn't fix it.
Boofo
03-28-2004, 09:24 AM
How can I add the "There have been X visits to this page since ***" to my stats?
Also, is there a way to get back the cell on the left with the stats.gif image? I tried doing it myself, but the tables got all messed up.
The x visits to my page is another hack that I made that I just added to my version of this hack. That was the only screenshot I could take at the time and that hack was included by mistake. ;)
I will see about adding the left column back in for those who want it in the next day or so. Will that work?
Boofo
03-28-2004, 09:27 AM
In fact, the tables got a little bit more messed up (both IE and Opera). See another screenshot. Some line appeared at the bottom of the stats block, that wasn't there before, also, how can i decrease the width between the title of the stats block, and the actual stats block?
See screenshot
This picture here looks like it is supposed to except for the line (as you call it) which can be fixed very easily.
Its probably just a <tr><td></td></tr> with the class of the td being thead.
How is the fix for the percentages doing? And that visits to this page since?
Boofo
03-28-2004, 09:51 AM
I think that last picture looks like it is supposed to, don't you?
The percentages is still a mystery at this point. I am waiting to hear from someone on a possible reason why it is messing up on larger boards. I will let you know as soon as I know. ;)
For this:
And that visits to this page since?
Post #180 of this thread explains that. I messed up the screen shot with another hack. ;)
djohn
03-28-2004, 09:52 AM
Right, i've removed the picture for now, how can i fix that "line" (don't know what you guys'd call it, but it's still a line to me :D) though?
Update: the "line" is gone after removing
<if condition="$birthdays == '' AND $upcomingevents == ''">
<tr><td class="thead" style="line-height: 0; padding: 0; margin: 0;" colspan="6"><img src="$vboptions[cleargifurl]" alt="" width="1" height="12" /></td></tr>
</if>
from the template, but I guess it's not right to do, because it seems to me that this chunk of code does something ;). Should I edit it somehow to fix my "line problem", and put it back into template?
djohn
03-28-2004, 09:57 AM
Yeah, the last one is fine exept for the "line"
The picture in this post: https://vborg.vbsupport.ru/showpost.php?p=491514&postcount=176 is the way that Opera displays the right side of the stats blocks. Look closely at the very right side of the tables.
Boofo
03-28-2004, 09:58 AM
Nope, you did it right. Since you have the threads hack below that one, you don't need that piece of code now. All that did was add a pretty blue line along the bottom to close it off nicely when you don't have anything else below this hack.
See? You're a hacker now. Good job! ;)
I think that last picture looks like it is supposed to, don't you?
The percentages is still a mystery at this point. I am waiting to hear from someone on a possible reason why it is messing up on larger boards. I will let you know as soon as I know. ;)
For this:
Post #180 of this thread explains that. I messed up the screen shot with another hack. ;)
I know that, but I requested it... It's something I would like to have if possible.
Boofo
03-28-2004, 10:00 AM
All I can say is make the colspan for this hack the same as the others in your template and see if that fixes it.
Boofo
03-28-2004, 10:03 AM
I know that, but I requested it... It's something I would like to have if possible.
And I'd like to have ... no, I won't go there. ;)
If you want to add another table and 2 extra queries (1 to update the cache and 1 to update the table) on your forumhome during the cache update, I'd be more than happy to give you what you need for that. ;)
hmmm. Is that a lot of extra load on the server?
Boofo
03-28-2004, 10:38 AM
Not really since the queries only run when updating the cache. It all depends on how you are about queries, I guess. They don't bother me as much as some others since my board doesn't have a lot of traffic yet. On vB2 I was running around 36 queries at all times on my forumhome where with vB3 I run around 13 from the cache and 26 on a cache update. That sounds like a lot but it is still better than it used to be. I'm not a query conscious as most people are, I guess. ;)
I think I'll get that microstats thing to count my queries first then...
Boofo
03-28-2004, 11:10 AM
That's why I didn't include it in the hack and why I said the screenshot was a mistake. ;)
oh I dont have that many queries going, so go ahead gimme the code please!
djohn
03-28-2004, 12:08 PM
See? You're a hacker now. Good job!
* djohn is proud of himself
All I can say is make the colspan for this hack the same as the others in your template and see if that fixes it.
I tried changing the colspan to different values (from 6 to 5) in all colspan's within your hack, in apparently, it made absolutely no difference whatsoever in Opera or IE... :ermm:
Boofo
03-28-2004, 01:24 PM
No, I meant change the hack colspans for this hack to the same thing as the other ones are for that area of the template. ;)
Boofo
03-28-2004, 01:49 PM
Ok, guys, let's try this code and see if it fixes our percentage problems.
Change the line that has this in it:
$stats['activepercent']
to the following:
if($stats['activepercent'] > 100)
{
$statscache['activepercent'] = vb_number_format(($numbermembers / $newuserid) * 100 / 1000, 2 ) . '%';
}
else
{
$statscache['activepercent'] = vb_number_format(($numbermembers / $newuserid) * 100, 2) . '%';
}
and let me know if this takes care of it.
I can't find $stats['activepercent'] in my code or in the txt installation file...
djohn
03-28-2004, 02:06 PM
wow, j00 rock!
got it all fixed!
Now, i have a racther liking-type question. If you look, the legend (Last updated at 04:04 PM - March 28th, 2004) is quite fate from the "line"m where it says "Forumname Statistics". Is there a way to squish them closer together?
Boofo
03-28-2004, 02:10 PM
What is fixed?
And no, there's no way to do that. Look at the advanced search box and you will see that is how the panels work in vB3. Sorry. ;)
Boofo
03-28-2004, 02:11 PM
I can't find $stats['activepercent'] in my code or in the txt installation file...
What percentage codes do you have then?
djohn
03-28-2004, 02:46 PM
What is fixed?
Problem with displaying the stats block in Opera
And no, there's no way to do that. Look at the advanced search box and you will see that is how the panels work in vB3. Sorry. ;)
Ah well, after all it's not something i badly needed. Doesn't matter, thanks for your hack and your support, anyway!
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topposterpercent'] % 10) == 0)
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent']) . '%';
else
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent'], 2) . '%';
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topthreadspercent'] % 10) == 0)
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent']) . '%';
else
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
This one?
Boofo
03-28-2004, 03:13 PM
No above all of that. It would have something like this in it:
numbermembers / $newuserid
Mijae
03-28-2004, 03:53 PM
That code isnt in my index.php, or the txt file.
???
Boofo
03-28-2004, 03:55 PM
Ok, give me the code you have ABOVE what Owen posted.
$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]);
$statscache['topposterpercent'] = round(100 * ($topposter[posts] / ($totalthreads + $totalposts)), 2);
$statscache['topstarter'] = $topstarter[postusername];
$statscache['topstarterid'] = intval ($topstarter[postuserid]);
$statscache['topstartercount'] = intval ($topstarter[count]);
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 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);
there is this...
Boofo
03-28-2004, 04:13 PM
Great! Ok, here we go!
Replace these 2 lines in that code:
$statscache['topposterpercent'] = round(100 * ($topposter[posts] / ($totalthreads + $totalposts)), 2);
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 2);
with this:
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) . '%';
}
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) . '%';
}
and delete these:
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topposterpercent'] % 10) == 0)
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent']) . '%';
else
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent'], 2) . '%';
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topthreadspercent'] % 10) == 0)
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent']) . '%';
else
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
and let me know what happens. make sure you set the update time at 0 to test this.
YUPS! It works! Thanks man.
Boofo
03-28-2004, 05:00 PM
Can you post a screenshot so I can see it?
<a href="http://www.vxforums.com" target="_blank">www.vxforums.com</a> live!
Boofo
03-28-2004, 05:16 PM
Is there a test account?
didnt realise...
uhm not really.
here:
Last updated at 07:13 PM - March 28th, 2004 Threads: 3,691 (2 Today), Posts: 54,677 (31 Today), Thread Views: 391,961
Total Registrations: 2336, Active Registrations: 2,336
There has been 1 new thread and 5 new posts since your list visit, Owen.
Top Poster: Owen (4,831 Posts = 8,475.44%)
Top Thread Starter: SSJ3 Goten (214 Threads = 7,133.33%)
Top Referrer: danthemansloan (5 Referrals)
Top Reputation: Owen (21 Reputation Points)
Most Viewed Profile: SSJ3 Goten (582 Views)
A warm welcome goes out to our newest member, ((0.1)).
Boofo
03-28-2004, 05:53 PM
But it was working? For how long?
less than an hour I think...
Boofo
03-28-2004, 06:25 PM
Go in and optimize and repair your tables in the Admin CP when you get a minute and see if that fixes it again. ;)
Boofo
03-28-2004, 06:41 PM
Also, do a hard refresh (CTRL+F5) and see if it fixes it. If it worked for an hour then the code HAS to be right, or it wouldn't work right at all.
still not working... I downloaded my index.php to make sure the code was still in there... It is..
lasto
03-28-2004, 09:30 PM
nice one boofo - good to know theres an update :)
lasto
03-28-2004, 10:01 PM
Boofo seeing as u good at stats is there any chance of this option
u know when in admin cp it sshows this
New Posts Today 1 New Threads Today 1
and have it reset at say 12 midnight ?
be even better if u can get it to say what the stats where for the previousday but i know im pushing me luck :)
Beermonster
03-29-2004, 07:15 AM
Thanks will be installing this one :)
Boofo
03-29-2004, 07:19 AM
Boofo seeing as u good at stats is there any chance of this option
u know when in admin cp it sshows this
New Posts Today 1 New Threads Today 1
and have it reset at say 12 midnight ?
be even better if u can get it to say what the stats where for the previousday but i know im pushing me luck :)
It resets at whatever time you have the board set at in the Admin CP.
Previous day stats would require another query or two, I'm afraid. ;)
lasto
03-29-2004, 07:23 AM
yeah cheers boofo but id like to see how many posts and threads where done each day not so bothered if u cant do previous days though :)
Boofo
03-29-2004, 07:31 AM
That will be in the update when I get it all together as well as percentages if I can get those all worked out for larger boards. ;)
Don't forget to click the install button so you can be notified when the update is released. ;)
blakkboy
03-31-2004, 02:47 PM
i dont know how to do this part
Turn on DEBUG and go to the Admin CP > vBulletin Options
Add New Setting:
Varname: forumhomecachetime
Setting Group: Forums Home Page Options
Title: Forumhome Stats Cache Update Time
Description: This setting allows you to set the interval (in minutes) between the Forumhome Stats Cache updates.
Option Code: leave blank
Default: 10
Display Order: 55
vBulletin Default: No
Boofo
03-31-2004, 02:53 PM
i dont know how to do this part
Check this post out. ;)
https://vborg.vbsupport.ru/showpost.php?p=482414&postcount=47
And don't forget to click install. I will be updating this hack in the next few days. ;)
blakkboy
04-01-2004, 04:22 AM
^^^ niiice
sabret00the
04-01-2004, 09:16 AM
can you make it do a thread of the day as well boofo?
ala https://vborg.vbsupport.ru/showthread.php?t=61260 but to fit into the current display style.
Boofo
04-01-2004, 09:35 AM
Haven't you figured out by now that I can do almost anything, sabret00the? Sure, I do most of it badly, but I do it! ;)
It can be added probably very easily. You just have to let me know how you want it to look with the thread of the day and I will see what I can do about adding it. I added (in my site version only so far) the member of the day hack by kentaurus (with his total permission, I might add) already so this shouldn't be too much of a chore to add to this hack, even for an idiot of my caliber. ;)
sabret00the
04-01-2004, 09:39 AM
a line just above the top poster line would be fine, just to say
Thread Of the Day is: vB3 Forumhome Stats Cache Serialize hack v2.2
not sure what query you'd do to decide thread of the day, but it would be good.
Boofo
04-01-2004, 09:48 AM
Wouldn't need a query. Just use the hack with the cron job and rearrange the code for the variable and VOILA! A homemade thread of the day addition to this hack. ;)
sabret00the
04-01-2004, 09:53 AM
you lost me :(
Boofo
04-01-2004, 10:00 AM
I t ' s...e a s y...t o...a d d. ;)
By the way, you DID vote for this hack in the HOTM, right? ;)
Now we need to get the others to do it. ;)
sabret00the
04-01-2004, 10:20 AM
we do need others to do it ;) it's a great hack, not to mentio you erwin and xenon seem to have the monopoly on hacks on my test board, so you deserve credit
Boofo
04-01-2004, 10:47 AM
Yes, but wouldn't it be nice to be running a hack of the month on your board, too? ;)
And I meant that we need others to vote for it, too. ;)
sabret00the
04-01-2004, 01:54 PM
it's being worked on :ninja:
I just installed the hack and all the percentages don't work, anything I can do to fix it?
Cheers,
Sebastian
Boofo
04-04-2004, 07:56 PM
I'm working on that and I might have a fix. If you want to test it out, pm me and I will tell you what to do with it. ;)
Please click the install button too as there will be an upgrade soin with the fix and some more stats added to it. ;)
Boofo sent me instructions on how to fix the percentage problems and it worked out nicely, expect a fix soon ;)
http://www.csbanana.com/stats3.jpg
ah cool, I am in need of that too.
Boofo
04-05-2004, 11:58 AM
PM me and I'll give you the code. I would like to test it on yours, too, to make sure it is right. ;)
Just go ahead and PM me ;) I'll check it out.
Boofo
04-05-2004, 01:35 PM
No, because I need you to test it out as soon as you get it so we can put it back like it was before it messes anything up if it doesn't work. When you're ready, let me know. I need your full attention while we are doing this. ;)
I am on msn, you dont seem to be online though...
Boofo
04-05-2004, 01:41 PM
You'll have to give me a few minutes. I'm right in the middle of helping someone with a hack. ;)
blakkboy
04-05-2004, 10:07 PM
i just updated to 2.2 and now i get this
please help me
Nj?rd Eriksson
04-06-2004, 02:27 AM
You'll have to give me a few minutes. I'm right in the middle of helping someone with a hack. ;)
Great hack, Boofo, but ...
... percentages still don't work (yes, I applied the changes you suggested (https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208).)
... I have a style-problem. The stats window is displayed in some sort of default vBulletin style in all my six styles to which I applied the modified FORUMHOME template (see screenshot.)
Do you have a fix for this? :)
Nj?rd Eriksson
04-06-2004, 07:25 AM
Great hack, Boofo, but ...
... percentages still don't work (yes, I applied the changes you suggested (https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208).)
... I have a style-problem. The stats window is displayed in some sort of default vBulletin style in all my six styles to which I applied the modified FORUMHOME template (see screenshot.)
Do you have a fix for this? :)
1. Fix for my style problem (might not be universal but did the job for me):
In the FORUMHOME template, replace:
<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">
<tr>
<td class="panelsurround" align="center" colspan="6">
<table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td align="$stylevar[left]">
<fieldset class="fieldset" style="margin:0px">
With:
<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">
<tr>
<td class="alt2"><img src="$stylevar[imgdir_misc]/stats.gif" alt="<phrase 1="$vboptions[bbtitle]">$vbphrase[x_statistics]</phrase>" border="0" /></td>
<td class="alt1" align="center" colspan="6">
<table class="alt1" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td align="$stylevar[left]">
<fieldset class="alt1" style="margin:0px">
2. Fix for the incorrect displayed percentages (not universal, works probably only for certain larger boards):
This fix is a modification of Boofo's modification which you can find here:
https://vborg.vbsupport.ru/showpost.php?p=491725&postcount=208
In index.php replace:
$statscache['topposterpercent'] = round(100 * ($topposter[posts] / ($totalthreads + $totalposts)), 2);
$statscache['topthreadspercent'] = round(100 * ($topstarter[count] / $totalthreads), 2);
With:
$statscache['topposterpercent'] = vb_number_format(($topposter[posts] / ($totalthreads + $totalposts)) * 100 / 1000, 2 ) . '%';
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100 / 1000, 2 ) . '%';
And delete this:
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topposterpercent'] % 10) == 0)
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent']) . '%';
else
$statscache['topposterpercent'] = vb_number_format($statscache['topposterpercent'], 2) . '%';
// Ditch the 2 decimal zeros on a whole percent ...
if (($statscache['topthreadspercent'] % 10) == 0)
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent']) . '%';
else
$statscache['topthreadspercent'] = vb_number_format($statscache['topthreadspercent'], 2) . '%';
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.