Top Stats

Download and support for PhpBB3 Top Stats Mod
User avatar
martin123456
BBCoder VI
BBCoder VI
Posts: 765
Joined: 25 Jul 2011, 13:29
BBCodes: 34
Favourite MOD: Ban button
Location: Down south!
Contact:

Top Stats

Post by martin123456 »

Below works with no errors also with debug on and its the only edits needed.


viewforum_body.html

Code: Select all

<!-- IF S_TSRAT_ENABLE -->
<!-- INCLUDE recent_active_body.html -->
<!-- ENDIF -->
	<!-- INCLUDE forumlist_body.html -->
<!-- ENDIF -->

<!-- IF S_TSMVT_ENABLE or S_TSMRT_ENABLE or S_TSMAU_ENABLE or S_TSMAF_ENABLE or S_TSLVB_ENABLE or S_TSLRU_ENABLE -->
<!-- INCLUDE top_stats_body.html -->
<!-- ENDIF -->
viewforum.php

Code: Select all

// Recent Active Topics
$flist = $auth->acl_getf('f_read', true);
$flist = array_unique(array_keys($flist));
$flist = array_merge($flist, array(0));
$enable_active_topics = (!empty($config['tsrat_enable']) ? true : false);
if ($enable_active_topics && sizeof($flist))
{   
   $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time, t.topic_views, t.topic_poster, t.topic_replies, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time, t.topic_last_view_time, t.topic_last_poster_id, f.forum_name, f.forum_image
      FROM ' . TOPICS_TABLE . ' t
      LEFT JOIN ' . FORUMS_TABLE . ' f ON (t.forum_id = f.forum_id)
      WHERE ' . $db->sql_in_set('t.forum_id', $flist) . ' AND t.topic_moved_id = 0 AND t.topic_approved = 1
      ORDER BY t.topic_last_post_time DESC';
   $result = $db->sql_query_limit($sql, $config['tsrat_number']);

   while ($row = $db->sql_fetchrow($result))
   {
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']);
      $view_last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
      $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']);
      $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']);
      $view_viewforum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']);
      
      $template->assign_block_vars('recent_active', array(
         'TOPIC_TITLE'               => $row['topic_title'],
         'TOPIC_TIME'                    => $user->format_date($row['topic_time']), 
         'TOPIC_VIEWS'               => $row['topic_views'],
         'TOPIC_REPLIES'               => $row['topic_replies'],
         'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
         'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
         'TOPIC_LAST_POSTER_NAME'      => $row['topic_last_poster_name'],
         'TOPIC_LAST_POSTER_COLOUR'      => $row['topic_last_poster_colour'],
         'TOPIC_LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
         'TOPIC_LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
         'U_FIRST_TOPIC'               => $view_topic_url,
         'U_LAST_TOPIC'               => $view_last_post_url,
         'USERNAME_FIRST'            => $view_first_poster,
         'USERNAME_LAST'               => $view_last_poster,
         'FORUM_NAME'               => $row['forum_name'],
         'FORUM_IMAGE'               => $row['forum_image'],
         'FORUM_URL'                  => $view_viewforum_url,
      ));
   }
   $db->sql_freeresult($result);
   
   $template->assign_vars(array(
   //isset we can enter a value ?  : 'or leave empty' (value)
   //!empty yes : no ,true : false (bool)
        'JSSCROLL_SPEED'            => (isset($config['tsjss_speed'])) ? $config['tsjss_speed'] : '',
      'JSSCROLL_INTERVAL'            => (isset($config['tsjss_interval'])) ? $config['tsjss_interval'] : '',
      'TSRAT_NUMBER'               => (isset($config['tsrat_number'])) ? $config['tsrat_number'] : '',
      'TS_JSSCROLL_DIRECTION'         => (!empty($config['ts_jsscroll_direction'])) ? true : false,
      'TS_JSSCROLL_PAUSE'            => (!empty($config['ts_jsscroll_pause'])) ? true : false,
      'TS_JSSCROLL_NAVIGATION'      => (!empty($config['ts_jsscroll_navigation'])) ? true : false,
      'S_TSRAT_ENABLE'               => (!empty($config['tsrat_enable'])) ? true : false,
      'S_TS_JSSCROLL'               => (isset($config['ts_jsscroll'])) ? $config['ts_jsscroll'] : '',
      'S_TS_TICKER'                  => (!empty($config['ts_ticker_enable'])) ? true : false,
    ));
}
stats.png
User avatar
martin123456
BBCoder VI
BBCoder VI
Posts: 765
Joined: 25 Jul 2011, 13:29
BBCodes: 34
Favourite MOD: Ban button
Location: Down south!
Contact:

Top Stats

Post by martin123456 »

And to show on viewtopic

open viewtopic_body.html

find

Code: Select all

<!-- INCLUDE overall_header.html -->
add after

Code: Select all

<!-- IF S_TSRAT_ENABLE -->
<!-- INCLUDE recent_active_body.html -->
<!-- ENDIF -->
  
<!-- IF S_TSMVT_ENABLE or S_TSMRT_ENABLE or S_TSMAU_ENABLE or S_TSMAF_ENABLE or S_TSLVB_ENABLE or S_TSLRU_ENABLE -->
<!-- INCLUDE top_stats_body.html -->
<!-- ENDIF -->
viewtopic.php

find

Code: Select all

page_footer();
add before

Code: Select all

// Recent Active Topics
$flist = $auth->acl_getf('f_read', true);
$flist = array_unique(array_keys($flist));
$flist = array_merge($flist, array(0));
$enable_active_topics = (!empty($config['tsrat_enable']) ? true : false);
if ($enable_active_topics && sizeof($flist))
{   
   $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time, t.topic_views, t.topic_poster, t.topic_replies, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time, t.topic_last_view_time, t.topic_last_poster_id, f.forum_name, f.forum_image
      FROM ' . TOPICS_TABLE . ' t
      LEFT JOIN ' . FORUMS_TABLE . ' f ON (t.forum_id = f.forum_id)
      WHERE ' . $db->sql_in_set('t.forum_id', $flist) . ' AND t.topic_moved_id = 0 AND t.topic_approved = 1
      ORDER BY t.topic_last_post_time DESC';
   $result = $db->sql_query_limit($sql, $config['tsrat_number']);

   while ($row = $db->sql_fetchrow($result))
   {
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']);
      $view_last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
      $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']);
      $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']);
      $view_viewforum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']);
      
      $template->assign_block_vars('recent_active', array(
         'TOPIC_TITLE'               => $row['topic_title'],
         'TOPIC_TIME'                    => $user->format_date($row['topic_time']), 
         'TOPIC_VIEWS'               => $row['topic_views'],
         'TOPIC_REPLIES'               => $row['topic_replies'],
         'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
         'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
         'TOPIC_LAST_POSTER_NAME'      => $row['topic_last_poster_name'],
         'TOPIC_LAST_POSTER_COLOUR'      => $row['topic_last_poster_colour'],
         'TOPIC_LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
         'TOPIC_LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
         'U_FIRST_TOPIC'               => $view_topic_url,
         'U_LAST_TOPIC'               => $view_last_post_url,
         'USERNAME_FIRST'            => $view_first_poster,
         'USERNAME_LAST'               => $view_last_poster,
         'FORUM_NAME'               => $row['forum_name'],
         'FORUM_IMAGE'               => $row['forum_image'],
         'FORUM_URL'                  => $view_viewforum_url,
      ));
   }
   $db->sql_freeresult($result);
   
   $template->assign_vars(array(
   //isset we can enter a value ?  : 'or leave empty' (value)
   //!empty yes : no ,true : false (bool)
        'JSSCROLL_SPEED'            => (isset($config['tsjss_speed'])) ? $config['tsjss_speed'] : '',
      'JSSCROLL_INTERVAL'            => (isset($config['tsjss_interval'])) ? $config['tsjss_interval'] : '',
      'TSRAT_NUMBER'               => (isset($config['tsrat_number'])) ? $config['tsrat_number'] : '',
      'TS_JSSCROLL_DIRECTION'         => (!empty($config['ts_jsscroll_direction'])) ? true : false,
      'TS_JSSCROLL_PAUSE'            => (!empty($config['ts_jsscroll_pause'])) ? true : false,
      'TS_JSSCROLL_NAVIGATION'      => (!empty($config['ts_jsscroll_navigation'])) ? true : false,
      'S_TSRAT_ENABLE'               => (!empty($config['tsrat_enable'])) ? true : false,
      'S_TS_JSSCROLL'               => (isset($config['ts_jsscroll'])) ? $config['ts_jsscroll'] : '',
      'S_TS_TICKER'                  => (!empty($config['ts_ticker_enable'])) ? true : false,
    ));
}
topic.png
User avatar
cabalganti
BBCoder II
BBCoder II
Posts: 15
Joined: 15 Sep 2012, 09:00
BBCodes: 3

Top Stats

Post by cabalganti »

It did the trick! You guys are the best! Thank you Stoker and Martin , thanks guys so much.

So, the solution for my question is:

Open:viewforum.php

Code: Select all

// Dump out the page header and load viewforum template
ADD BEFORE:

Code: Select all

    // Recent Active Topics
    $flist = $auth->acl_getf('f_read', true);
    $flist = array_unique(array_keys($flist));
    $flist = array_merge($flist, array(0));
    $enable_active_topics = (!empty($config['tsrat_enable']) ? true : false);
    if ($enable_active_topics && sizeof($flist))
    {   
       $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time, t.topic_views, t.topic_poster, t.topic_replies, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time, t.topic_last_view_time, t.topic_last_poster_id, f.forum_name, f.forum_image
          FROM ' . TOPICS_TABLE . ' t
          LEFT JOIN ' . FORUMS_TABLE . ' f ON (t.forum_id = f.forum_id)
          WHERE ' . $db->sql_in_set('t.forum_id', $flist) . ' AND t.topic_moved_id = 0 AND t.topic_approved = 1
          ORDER BY t.topic_last_post_time DESC';
       $result = $db->sql_query_limit($sql, $config['tsrat_number']);

       while ($row = $db->sql_fetchrow($result))
       {
          $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']);
          $view_last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
          $view_first_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']);
          $view_last_poster = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']);
          $view_viewforum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']);
          
          $template->assign_block_vars('recent_active', array(
             'TOPIC_TITLE'               => $row['topic_title'],
             'TOPIC_TIME'                    => $user->format_date($row['topic_time']),
             'TOPIC_VIEWS'               => $row['topic_views'],
             'TOPIC_REPLIES'               => $row['topic_replies'],
             'TOPIC_FIRST_POSTER_NAME'      => $row['topic_first_poster_name'],
             'TOPIC_FIRST_POSTER_COLOUR'      => $row['topic_first_poster_colour'],
             'TOPIC_LAST_POSTER_NAME'      => $row['topic_last_poster_name'],
             'TOPIC_LAST_POSTER_COLOUR'      => $row['topic_last_poster_colour'],
             'TOPIC_LAST_POST_TIME'         => $user->format_date($row['topic_last_post_time']),
             'TOPIC_LAST_VIEW_TIME'         => $user->format_date($row['topic_last_view_time']),
             'U_FIRST_TOPIC'               => $view_topic_url,
             'U_LAST_TOPIC'               => $view_last_post_url,
             'USERNAME_FIRST'            => $view_first_poster,
             'USERNAME_LAST'               => $view_last_poster,
             'FORUM_NAME'               => $row['forum_name'],
             'FORUM_IMAGE'               => $row['forum_image'],
             'FORUM_URL'                  => $view_viewforum_url,
          ));
       }
       $db->sql_freeresult($result);
       
       $template->assign_vars(array(
       //isset we can enter a value ?  : 'or leave empty' (value)
       //!empty yes : no ,true : false (bool)
            'JSSCROLL_SPEED'            => (isset($config['tsjss_speed'])) ? $config['tsjss_speed'] : '',
          'JSSCROLL_INTERVAL'            => (isset($config['tsjss_interval'])) ? $config['tsjss_interval'] : '',
          'TSRAT_NUMBER'               => (isset($config['tsrat_number'])) ? $config['tsrat_number'] : '',
          'TS_JSSCROLL_DIRECTION'         => (!empty($config['ts_jsscroll_direction'])) ? true : false,
          'TS_JSSCROLL_PAUSE'            => (!empty($config['ts_jsscroll_pause'])) ? true : false,
          'TS_JSSCROLL_NAVIGATION'      => (!empty($config['ts_jsscroll_navigation'])) ? true : false,
          'S_TSRAT_ENABLE'               => (!empty($config['tsrat_enable'])) ? true : false,
          'S_TS_JSSCROLL'               => (isset($config['ts_jsscroll'])) ? $config['ts_jsscroll'] : '',
          'S_TS_TICKER'                  => (!empty($config['ts_ticker_enable'])) ? true : false,
        ));
    }

Open: styles/prosilver/template/viewforum_body.html

Code: Select all

<!-- INCLUDE forumlist_body.html -->

ADD BEFORE:

Code: Select all

<!-- IF S_TSRAT_ENABLE -->
<!-- INCLUDE recent_active_body.html -->
<!-- ENDIF -->
This will make the scrolling element in Top Stats, to show in every forum.
Last edited by cabalganti on 07 Oct 2012, 20:48, edited 1 time in total.
User avatar
martin123456
BBCoder VI
BBCoder VI
Posts: 765
Joined: 25 Jul 2011, 13:29
BBCodes: 34
Favourite MOD: Ban button
Location: Down south!
Contact:

Top Stats

Post by martin123456 »

Add this part so your members dont have to sit and wait for a topic to scroll back around lol

Code: Select all

<!-- IF S_TSMVT_ENABLE or S_TSMRT_ENABLE or S_TSMAU_ENABLE or S_TSMAF_ENABLE or S_TSLVB_ENABLE or S_TSLRU_ENABLE -->
<!-- INCLUDE top_stats_body.html -->
<!-- ENDIF -->
as i have posted in the first post i made.
User avatar
Steve
BBCoder VI
BBCoder VI
Posts: 847
Joined: 05 Mar 2010, 01:10
BBCodes: 2000
Favourite BBCode: p**n tube
Favourite MOD: Non of Stokers

Top Stats

Post by Steve »

hook_top_stats.php /upload into includes/hooks/ folder :P
Last edited by Steve on 08 Oct 2012, 08:50, edited 1 time in total.
Steve wrote: 14 Nov 2024, 16:45 It's happy bastard day!
User avatar
martin123456
BBCoder VI
BBCoder VI
Posts: 765
Joined: 25 Jul 2011, 13:29
BBCodes: 34
Favourite MOD: Ban button
Location: Down south!
Contact:

Top Stats

Post by martin123456 »

Steve© wrote:hook_top_stats.php /upload into includes/hooks/ folder :P
includes.zip
[phpBB Debug] PHP Notice: in file [ROOT]/includes/hooks/hook_top_stats.php on line 17: Undefined variable: auth

Fatal error: Call to a member function acl_getf() on a non-object in C:\xampp\htdocs\includes\hooks\hook_top_stats.php on line 17

:P :P
User avatar
Steve
BBCoder VI
BBCoder VI
Posts: 847
Joined: 05 Mar 2010, 01:10
BBCodes: 2000
Favourite BBCode: p**n tube
Favourite MOD: Non of Stokers

Top Stats

Post by Steve »

includes.zip
(1.87 KiB) Downloaded 144 times
:lol:
Steve wrote: 14 Nov 2024, 16:45 It's happy bastard day!
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Top Stats

Post by Stoker »

Steve© wrote:
includes.zip
:lol:
What if we only want it activated on index?

Thanks for the hooker, just what I needed ;) 8-)
Board rules! No PM support
User avatar
Steve
BBCoder VI
BBCoder VI
Posts: 847
Joined: 05 Mar 2010, 01:10
BBCodes: 2000
Favourite BBCode: p**n tube
Favourite MOD: Non of Stokers

Top Stats

Post by Steve »

$config it..
Steve wrote: 14 Nov 2024, 16:45 It's happy bastard day!
User avatar
cabalganti
BBCoder II
BBCoder II
Posts: 15
Joined: 15 Sep 2012, 09:00
BBCodes: 3

Top Stats

Post by cabalganti »

There you go, another bit of my appreciation :thumb:
Thank you much guys!
I would like to see the kind of support you guys provide here in some other forums.
You guys are the best, no kidding. 8-)
Locked