PDA

View Full Version : Board Optimization - headStatz


Coders Shack
10-20-2007, 10:00 PM
value. . . . . . . . Brought to you by
https://vborg.vbsupport.ru/
. . . http://www.Scriptasy.com

value

Installation Time: < 5 mins
Product: 1
Files: 1
VB Version: 3.6.X


Description:
I wanted to display the current amount of guests and users online without adding any stressful queries. So basically this mod provides the following variables you can use globally in templates:$hsz[guests] - shows the current count of guests online
$hsz[gphrase] - is the word guest or guests deturmined by how many guests are online
$hsz[members] - shows the current count of members online
$hsz[mphrase] - is the word member or members deturmined by how many members are online
$hsz[total] - is the total amount of guests and members online
$hsz[totalthreads] - total forum threads
$hsz[totalposts] - total forum posts
$hsz[totalmembers] - total forum membersThis does add one query to every page, buts its a harmless query. If you would like to remove the query you can make the following file edit:

FILE: /includes/class_core.php
FIND: var $defaultitems = array(ADD UNDER: 'headstatz',now the mod will add zero queries.

Installation Instructions:
Install Product
Make your own template editsIf you like then [Mark As Installed (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=160764)]

Coders Shack
10-21-2007, 07:26 PM
some people may not have a use for this mod but i decided to release it because i needed it.

you can see an example of its use on my forum: http://www.scriptasy.com its under the navbar.

also if you want to use it on a vbadvanced page just allow the following global var in the vbaCP "hsz"

Shazz
10-21-2007, 07:29 PM
Small nice feature Coders Shack.

Coders Shack
10-21-2007, 07:30 PM
yea i didn't want the online count to be recalculated every pageload so i made a datastore entry that stores the $hsz values.

yoyoyoyo
10-21-2007, 07:31 PM
I like it :)

FreshFroot
10-21-2007, 09:51 PM
Still a good hack, some of those variables would be useful. thanks :)

Coders Shack
10-21-2007, 10:02 PM
I found out that on the "You are required to login" pages the var's don't work.

So you should just do this to prevent bad output:


<if condition="is_array($hsz)">
YOUR CONTENT AND VARS
</if>

TCattitude
11-08-2007, 04:07 PM
The datastore update in the cron file, is missing table_prefix.

FCS-Webmaster
11-11-2007, 03:46 PM
Is there a possibility to read out how many hits in total i`ve had?!

Coders Shack
11-11-2007, 08:56 PM
Is there a possibility to read out how many hits in total i`ve had?!
you have the right idea, this would be the mod that you would want to use to have counter. Keep in mind though a hit counter would add one query per page view.

Nordinho
04-19-2009, 08:47 PM
I know this is an old plugin, however I do have a use for it...

Anyways, it works fine on 3.82 except for messing up the blog page. With the plugin enabled the main blog page gives the error below

<!--
Database error in vBulletin 3.8.2:

Invalid SQL:


SELECT COUNT(*) AS total,
FROM_UNIXTIME(dateline - , '%c-%e-%Y') AS period
FROM blog AS blog
LEFT JOIN blog_user AS blog_user ON (blog_user.bloguserid = blog.userid)
WHERE options_guest &amp; 1 AND ~blog.options &amp; 8 AND state IN('visible') AND dateline &gt;= 1237676400 AND dateline &lt; 1240177194
GROUP BY period;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '%c-%e-%Y') AS period
FROM blog AS blog
LEFT JOIN blog_user AS blog_user ' at line 2
Error Number : 1064


Anybody an idea??

Nordinho
05-04-2009, 11:26 AM
Bumperdibump

edit

Applying the 'save a query' patch solved my problems!