EzPortal - Portal Software for Forums

EzPortal - Made to Fit Your SMF Forum - Glad You Found Us!
+- +-

UserBox

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Recent Posts

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Re: Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 02:09:24 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:55:53 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 01:47:42 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:34:07 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 12:20:17 pm

+- HTML Menu


Sample HTML Block Usage - You May Custom Code it, as needed!

Recent Topics ezBlock

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Where is the facebook button color? by EzPortal
February 28, 2023, 06:45:09 pm

Display on Mobile - SMF 2.1.3 and EZ 5.5.2 by BugginIn
December 29, 2022, 04:07:13 pm

Blocks Help by Riggs1973
November 20, 2022, 12:59:30 pm

Surface ol lite theme release Free! by Steffen K.
November 18, 2022, 03:57:24 am

Undefined index: href by EzPortal
October 04, 2022, 08:49:59 pm

SMF-ezportal_column_5.cache): failed to open stream: No such file or directory by EzPortal
June 04, 2022, 11:40:13 am

Arcade block error: failed to open stream: No such file or directory by Shades
May 20, 2022, 02:47:13 pm

Author Topic: Stats block  (Read 25626 times)

0 Members and 1 Guest are viewing this topic.

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
  • Gender: Male
Stats block
« on: November 01, 2009, 01:03:39 am »
Would it be possible to get a copy of the Stats EzBlock that you use on your SMFHacks forum vbgamer?

It does exactly what I'm looking for!

Regards
Eddy

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
  • Gender: Male
Re: Stats block
« Reply #1 on: November 02, 2009, 12:25:32 pm »
I see now that your using TP on the other site..... Nevermind, I took the original TP stats block and modified if to work with EzPortal  :)

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: Stats block
« Reply #2 on: November 02, 2009, 06:34:34 pm »
Yeah going to probably switch over once SMF 2.0 is released just taking a long time more than I thought.
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
  • Gender: Male
Re: Stats block
« Reply #3 on: November 12, 2009, 03:20:07 am »
I have a problem with the Stats block I wrote for EzPortal - It worked fine under SMF 1.1.10, but now that I've upgraded to SMF 2.0 RC2 it just generates a fatal error:

Call to undefined function db_query() in smf/Sources/Load.php(2078) eval()'d code(1489): eval()'d code on line 27

I'm no programmer, so I'm sure it's something silly that I've done wrong - Can anyone help please?

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE block-info SYSTEM "http://www.ezportal.com/xml/block-info">
<block-info xmlns="http://www.ezportal.com/xml/block-info" xmlns:ezportal="http://www.ezportal.com/">
<id>eddymatthews:additionalstats</id>
<title>Additional Stats</title>
<version>1.1</version>
<blocktype>php</blocktype>
<forumversion>SMF 2.0.x</forumversion>
<author>Eddy Matthews</author>
<website>http://www.paddleducks.co.uk</website>
<editable>1</editable>
<can_cache>1</can_cache>


<blockdata><![CDATA[global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

    $bullet = '<img src="'.$settings['images_url'].'/icons/divider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet2 = '<img src="'.$settings['images_url'].'/icons/divider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet3 = '<img src="'.$settings['images_url'].'/icons/divider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet4 = '<img src="'.$settings['images_url'].'/icons/goto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet5 = '<img src="'.$settings['images_url'].'/icons/module2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>','Members','</b></a>
                 <br />'.$bullet,'Total Members',': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet,'Latest',': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>','Stats','</b></a>
                 <br />'.$bullet,'Total Posts',': '.$modSettings['totalMessages']. '
                                  <br />'.$bullet,'Total Topics',': '.$modSettings['totalTopics']. '
                                  <br />'.$bullet,'Most Online Today',': '.$modSettings['mostOnlineToday'].'
                                  <br />'.$bullet,'Most Online Ever',': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>','Users Online','</b></a><br />';

            $online = ssi_whosOnline('array');
           echo $bullet,'Members',': '.$online['num_users'];
           echo '<br />'.$bullet,'Guests',': '.$online['guests'];
           echo '<br />'.$bullet,'Spiders: ', $online['num_spiders'];
           echo '<br />'.$bullet,'Total',': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
echo '</div>';
                }
        echo '</div>';]]></blockdata>

</block-info>

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: Stats block
« Reply #4 on: November 12, 2009, 08:08:52 am »
Fixed
Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE block-info SYSTEM "http://www.ezportal.com/xml/block-info">
<block-info xmlns="http://www.ezportal.com/xml/block-info" xmlns:ezportal="http://www.ezportal.com/">
<id>eddymatthews:additionalstats</id>
<title>Additional Stats</title>
<version>1.1</version>
<blocktype>php</blocktype>
<forumversion>SMF 2.0.x</forumversion>
<author>Eddy Matthews</author>
<website>http://www.paddleducks.co.uk</website>
<editable>1</editable>
<can_cache>1</can_cache>


<blockdata><![CDATA[global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

    $bullet = '<img src="'.$settings['images_url'].'/icons/divider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet2 = '<img src="'.$settings['images_url'].'/icons/divider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet3 = '<img src="'.$settings['images_url'].'/icons/divider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet4 = '<img src="'.$settings['images_url'].'/icons/goto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
    $bullet5 = '<img src="'.$settings['images_url'].'/icons/module2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>','Members','</b></a>
                 <br />'.$bullet,'Total Members',': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet,'Latest',': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';

global $smcFunc,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = $smcFunc['db_query']('',"SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {db_prefix}members
WHERE is_activated = 1");
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>','Stats','</b></a>
                 <br />'.$bullet,'Total Posts',': '.$modSettings['totalMessages']. '
                                  <br />'.$bullet,'Total Topics',': '.$modSettings['totalTopics']. '
                                  <br />'.$bullet,'Most Online Today',': '.$modSettings['mostOnlineToday'].'
                                  <br />'.$bullet,'Most Online Ever',': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>','Users Online','</b></a><br />';

            $online = ssi_whosOnline('array');
           echo $bullet,'Members',': '.$online['num_users'];
           echo '<br />'.$bullet,'Guests',': '.$online['guests'];
           echo '<br />'.$bullet,'Spiders: ', $online['num_spiders'];
           echo '<br />'.$bullet,'Total',': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
echo '</div>';
                }
        echo '</div>';]]></blockdata>

</block-info>
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
  • Gender: Male
Re: Stats block
« Reply #5 on: November 12, 2009, 09:15:07 am »
Thanks vbgamer,

That's got it all working again.... Just one minor tweak needed, the lines that do the COUNT query need to be altered slightly...

For example,

COUNT(dateRegistered > $today OR NULL) as today

Needs to be changed to:

COUNT(date_registered >$today OR NULL) as today

Once that is done to each of the COUNT queries it works fine...

Regards
Eddy

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: Stats block
« Reply #6 on: November 12, 2009, 12:43:46 pm »
Glad you got it working.
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline omar

  • Posts: 2
  • Karma: 0
  • Gender: Male
Re: Stats block
« Reply #7 on: November 30, 2009, 09:21:27 pm »
I'm new to ezblock and i was looking for a stats block, i was wondering if i could borrow this code.

Offline Eddy Matthews

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 1
  • Gender: Male
Re: Stats block
« Reply #8 on: December 01, 2009, 01:11:48 am »
I'm new to ezblock and i was looking for a stats block, i was wondering if i could borrow this code.

Please help yourself and use it if you wish.... If you make any changes, please let us know!

Regards
Eddy

Offline omar

  • Posts: 2
  • Karma: 0
  • Gender: Male
Re: Stats block
« Reply #9 on: December 01, 2009, 03:54:55 pm »
thank you, i will let you know if i make any changes.

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: Stats block
« Reply #10 on: February 01, 2010, 06:38:26 pm »
Stats block added to ezPortal 0.3.5
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline DJ Omnimaga

  • Posts: 13
  • Karma: 0
Re: Stats block
« Reply #11 on: February 02, 2010, 03:04:53 am »
Question, I am using a modified version of the stats block above that only shows the following:

Quote
Members: 266
Posts: 20514
Topics: 970

However, I would like it to look like:

Quote
Members: 266
Posts: 20514 (76915
since May 12th 2005)
Topics: 970

As you might guess, I want to display both my current board post count, then in parhentesis I want to display the total including the 56401 posts from an old board we had until we shutted down for a while). However, after doing 2 hours of Google search on PHP variables and the like, I could not figure out how to echo the sum of both (the 56401 being a fixed number). I was wondering if anyone could tell me how I would do it? That might actually help me if I wanted to do something similar in the future on other forums or pages. Here is the code I have right now (not cleaned up yet):

Code: [Select]
global $context, $boarddir, $settings, $options, $scripturl, $user_info, $modSettings;


require($boarddir.'/SSI.php');

echo'
<div style="font-family: verdana, arial, sans-serif;">';

   // more stats
            echo '<b>Members</b>',': ' , isset($modSettings['memberCount']) ?

$modSettings['memberCount'] : $modSettings['totalMembers'] , '

<br /><b>Posts</b>',': '.$modSettings['totalMessages']. '
                                  <br /><b>Topics</b>',': '.$modSettings['totalTopics']. '';

Thanks in advance!

 

Related Topics

  Subject / Started by Replies Last post
3 Replies
17016 Views
Last post April 12, 2009, 04:37:07 am
by alex clone
3 Replies
7113 Views
Last post January 26, 2010, 07:59:31 pm
by EzPortal
8 Replies
9088 Views
Last post February 25, 2010, 12:40:50 pm
by Sharb8
0 Replies
7002 Views
Last post March 30, 2010, 07:17:08 am
by Feldpost
11 Replies
15314 Views
Last post June 27, 2010, 10:08:14 am
by Goad

+-SMF Gallery

Quick Menu


Powered by EzPortal