Top Five

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
Seanie Morris
Registered User
Posts: 61
Joined: Fri Sep 01, 2006 12:05 pm
Location: Offaly, Ireland

Re: top_five

Post by Seanie Morris »

This looks like a MOD I have been looking for (thanks RMcGirr83) for quite a while, but what is the way to add this to e.g. the site's welcome page (index.html or forums.html or any other .html page) for enticing the visitor to visit the forums?

Thanks in advance,

Seanie.

ipodlin
Registered User
Posts: 6
Joined: Tue May 05, 2009 9:02 pm

Re: top_five

Post by ipodlin »

Did you ever get the forum name issue fixed?

[DATE] [FORUM SECTION] TOPIC TITLE

How can I get that?

This isn't working:

Code: Select all

'TOPIC_TITLE'   => '[' . $row['forum_name'] . '] ' . $topic_title));

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: top_five

Post by RMcGirr83 »

Please post up your entire includes/top_five.php file
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

ipodlin
Registered User
Posts: 6
Joined: Tue May 05, 2009 9:02 pm

Re: top_five

Post by ipodlin »

I figured it out, here's what i did:

Code: Select all

'POST_ERA' => '[' . $user->format_date($row['post_time']) . '] ',
'POST_SECTION' => '[' . $row['forum_name'] . '] ',
'TOPIC TITLE' => $row['topic_title']));
i have all 3 of those in the top 5 html template linking to the topic title:

Code: Select all

'U_TOPIC' 		=> $view_topic_url,
but i'd like to have the post section link to the post section, any help on that?

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: top_five

Post by RMcGirr83 »

RMcGirr83 wrote:Please post up your entire includes/top_five.php file
I need to see what variables you are using.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

ipodlin
Registered User
Posts: 6
Joined: Tue May 05, 2009 9:02 pm

Re: top_five

Post by ipodlin »

sorry, here it is:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: top_five.php,v 1.0.4 2009/01/26 19:38:00 EST rmcgirr83 Exp $
* @copyright (c)Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
	define('INCLUDES_TOP_FIVE_PHP', true);
	
	global $auth, $cache, $config, $user, $db, $phpbb_root_path, $phpEx, $template;

    $user->add_lang('mods/top_five');

	// grab auths that allow a user to read a forum
	$forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));

	// we have auths, change the sql query below
	$sql_and = '';
	if (sizeof($forum_array))
	{
		$sql_and = ' AND ' . $db->sql_in_set('p.forum_id', $forum_array, true);
	}

	// grab all posts that meet criteria and auths
	$sql_ary = array(
'SELECT'   => 'MAX(p.post_time) as post_time, u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, f.forum_name
',
		'FROM'		=> array(TOPICS_TABLE => 't', POSTS_TABLE => 'p'),
		'LEFT_JOIN'	=> array(
			array(
				'FROM'	=> array(USERS_TABLE => 'u'),
				'ON'	=> 'p.poster_id = u.user_id',
   			),
         array(
            'FROM'   => array(FORUMS_TABLE => 'f'),
            'ON'   => 't.forum_id = f.forum_id',
            ),
		),
		'WHERE'		=> 'p.topic_id = t.topic_id
			   AND p.post_approved = 1
			   AND t.topic_moved_id = 0' . $sql_and,
		'GROUP_BY'	=> 't.topic_id',
		'ORDER_BY'	=> 'p.post_time DESC',
	);

	$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 50);

    while( $row = $db->sql_fetchrow($result) )
    {
   
		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
		$topic_title = censor_text($row['topic_title']);

       	$template->assign_block_vars('hot_topic_row',array(
       	'POST_ERA' => '[' . $user->format_date($row['post_time']) . '] ',	 'U_TOPIC' 		=> $view_topic_url,
   	'POST_SECTION'	=> '[' . $row['forum_name'] . '] ',
       		'TOPIC_TITLE'    => $row['topic_title']));
    }

    $db->sql_freeresult($result);

	// an array of user types we dont' bother with
	// could add board founder (USER_FOUNDER) if wanted
	$ignore_users = array(USER_IGNORE, USER_INACTIVE);
	
	// top five posters
	if (($user_posts = $cache->get('_top_five_posters')) === false)
	{
	    $user_posts = array();

		// grab users with most posts
	    $sql = 'SELECT user_id, username, user_colour, user_posts
	       	FROM ' . USERS_TABLE . '
			WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
				AND user_posts <> 0
	       ORDER BY user_posts DESC';
		$result = $db->sql_query_limit($sql, 50);

		while ($row = $db->sql_fetchrow($result))
		{
			$user_posts[$row['user_id']] = array(
				'user_id'		=> $row['user_id'],
                'username'		=> $row['username'],
                'user_colour'	=> $row['user_colour'],
				'user_posts'    => $row['user_posts'],
			);
		}
        $db->sql_freeresult($result);

		// cache this data for 1 hour, this improves performance
		$cache->put('_top_five_posters', $user_posts, 300);
	 }

	 foreach ($user_posts as $row)
	 {
		$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		$template->assign_block_vars('top_five_active',array(
			'S_SEARCH_ACTION'	=> append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
			'POSTS' 			=> $row['user_posts'],
			'USERNAME_FULL'		=> $username_string)
	   );
    }

    // newest registered users
	if (($newest_users = $cache->get('_top_five_newest_users')) === false)
	{
	    $newest_users = array();

	    // grab most recent registered users
		$sql = 'SELECT user_id, username, user_colour, user_regdate
			FROM ' . USERS_TABLE . '
			WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
				AND user_inactive_reason = 0
			ORDER BY user_regdate DESC';
		$result = $db->sql_query_limit($sql, 50);

		while ($row = $db->sql_fetchrow($result))
		{
			$newest_users[$row['user_id']] = array(
				'user_id'				=> $row['user_id'],
				'username'				=> $row['username'],
     			'user_colour'			=> $row['user_colour'],
                'user_regdate'			=> $row['user_regdate'],
			);
		}
	    $db->sql_freeresult($result);

		// cache this data for 5 minutes, this improves performance
		$cache->put('_top_five_newest_users', $newest_users, 300);
	 }

	 foreach ($newest_users as $row)
	 {
		$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		$template->assign_block_vars('top_five_newest',array(
			'REG_DATE'			=> $user->format_date($row['user_regdate']),
			'USERNAME_FULL'		=> $username_string)
	   );
    }
}
?>
thx again for your help

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: top_five

Post by RMcGirr83 »

Have you changed anything in the html that comes with the download of the mod?
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

ipodlin
Registered User
Posts: 6
Joined: Tue May 05, 2009 9:02 pm

Re: top_five

Post by ipodlin »

yes, here it is:

Code: Select all

<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
		<tr>
			<td class="cat" width="100%"><h4>{L_NEWEST_TOPICS}</h4></td>
		</tr>
		<tr>
			<td class="row1"><!-- BEGIN hot_topic_row --><span class="genmed"><a href="{hot_topic_row.U_TOPIC}">{hot_topic_row.POST_ERA}{hot_topic_row.POST_SECTION}{hot_topic_row.TOPIC_TITLE}</a></span><br /><!-- END hot_topic_row --></td>
		</tr>
</table>

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: top_five

Post by RMcGirr83 »

Try

includes/top_five.php

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: top_five.php,v 1.0.4 2009/01/26 19:38:00 EST rmcgirr83 Exp $
* @copyright (c)Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
   define('INCLUDES_TOP_FIVE_PHP', true);
   
   global $auth, $cache, $config, $user, $db, $phpbb_root_path, $phpEx, $template;

    $user->add_lang('mods/top_five');

   // grab auths that allow a user to read a forum
   $forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));

   // we have auths, change the sql query below
   $sql_and = '';
   if (sizeof($forum_array))
   {
      $sql_and = ' AND ' . $db->sql_in_set('p.forum_id', $forum_array, true);
   }

   // grab all posts that meet criteria and auths
   $sql_ary = array('SELECT'   => 'MAX(p.post_time) as post_time, u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, f.forum_name
',
      'FROM'      => array(TOPICS_TABLE => 't', POSTS_TABLE => 'p'),
      'LEFT_JOIN'   => array(
         array(
            'FROM'   => array(USERS_TABLE => 'u'),
            'ON'   => 'p.poster_id = u.user_id',
            ),
         array(
            'FROM'   => array(FORUMS_TABLE => 'f'),
            'ON'   => 't.forum_id = f.forum_id',
            ),
      ),
      'WHERE'      => 'p.topic_id = t.topic_id
            AND p.post_approved = 1
            AND t.topic_moved_id = 0' . $sql_and,
      'GROUP_BY'   => 't.topic_id',
      'ORDER_BY'   => 'p.post_time DESC',
   );

   $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 50);

    while( $row = $db->sql_fetchrow($result) )
    {
   
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
	  $viewforum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']);
      $topic_title = censor_text($row['topic_title']);
		
		$template->assign_block_vars('hot_topic_row',array(
			'POST_ERA' 		=> '[' . $user->format_date($row['post_time']) . '] ',
			'U_TOPIC'       => $view_topic_url,
			'U_FORUM'		=> $viewforum_url,
			'POST_SECTION'	=> '[' . $row['forum_name'] . '] ',
			'TOPIC_TITLE'	=> $topic_title)
		);
    }

    $db->sql_freeresult($result);

   // an array of user types we dont' bother with
   // could add board founder (USER_FOUNDER) if wanted
   $ignore_users = array(USER_IGNORE, USER_INACTIVE);
   
   // top five posters
   if (($user_posts = $cache->get('_top_five_posters')) === false)
   {
       $user_posts = array();

      // grab users with most posts
       $sql = 'SELECT user_id, username, user_colour, user_posts
             FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_posts <> 0
          ORDER BY user_posts DESC';
      $result = $db->sql_query_limit($sql, 50);

      while ($row = $db->sql_fetchrow($result))
      {
         $user_posts[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_posts'    => $row['user_posts'],
         );
      }
        $db->sql_freeresult($result);

      // cache this data for 1 hour, this improves performance
      $cache->put('_top_five_posters', $user_posts, 300);
    }

    foreach ($user_posts as $row)
    {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_active',array(
         'S_SEARCH_ACTION'   => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
         'POSTS'          => $row['user_posts'],
         'USERNAME_FULL'      => $username_string)
      );
    }

    // newest registered users
   if (($newest_users = $cache->get('_top_five_newest_users')) === false)
   {
       $newest_users = array();

       // grab most recent registered users
      $sql = 'SELECT user_id, username, user_colour, user_regdate
         FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_inactive_reason = 0
         ORDER BY user_regdate DESC';
      $result = $db->sql_query_limit($sql, 50);

      while ($row = $db->sql_fetchrow($result))
      {
         $newest_users[$row['user_id']] = array(
            'user_id'            => $row['user_id'],
            'username'            => $row['username'],
              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],
         );
      }
       $db->sql_freeresult($result);

      // cache this data for 5 minutes, this improves performance
      $cache->put('_top_five_newest_users', $newest_users, 300);
    }

    foreach ($newest_users as $row)
    {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_newest',array(
         'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)
      );
    }
}
?>
the html file edits

Code: Select all

<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
      <tr>
         <td class="cat" width="100%"><h4>{L_NEWEST_TOPICS}</h4></td>
      </tr>
      <tr>
         <td class="row1"><!-- BEGIN hot_topic_row --><span class="genmed">{hot_topic_row.POST_ERA} <a href="{hot_topic_row.U_FORUM}">{hot_topic_row.POST_SECTION}</a> <a href="{hot_topic_row.U_TOPIC}">{hot_topic_row.TOPIC_TITLE}</a></span><br /><!-- END hot_topic_row --></td>
      </tr>
</table>
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

ipodlin
Registered User
Posts: 6
Joined: Tue May 05, 2009 9:02 pm

Re: top_five

Post by ipodlin »

Thank you so much RMcGirr83!! Really appreciate your help with this. :)

starsun
Registered User
Posts: 4
Joined: Thu Oct 22, 2009 12:40 am

Re: top_five

Post by starsun »

gosh! i love this mod, u own RMcGirr83!

just.. i got a problem.. i read all post from here searching if there was a way to fix the issue im having..

ok, here's the issue: im also using a flag mod.. and i want to use it with this mod..

something like..
ie:

Last post top 5 users new members
-----------------------------------------------------------------------------------------------
topic by: (flag)user (flag)user post: 23 (flag)user date.. etc..
topic by; (flag)user2 (flag)user2 post: 76 (flag)user date.. etc..

i would appreciate alot if u could help me up with this one..

Sorry about my english.. lol.. :p
Regards! Kate

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: top_five

Post by RMcGirr83 »

Link to the mod please
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

starsun
Registered User
Posts: 4
Joined: Thu Oct 22, 2009 12:40 am

Re: top_five

Post by starsun »

http://www.phpbbhacks.com/download/8971 <--- this mod

http://nopalteam.hyperphp.com/reyrana/index.php <--- site where i want it to work

Thank You! :)

aquatalk
Registered User
Posts: 2
Joined: Tue Sep 29, 2009 5:49 am

Re: top_five

Post by aquatalk »

Love this mod, very well done.

I put in the code to make everything 1 line and have a question. Is it possible to format the lines with the topic on the left, poster on the right, then in the top posters area user on the left, number of posts on the right, and the joined, user on the left, date to the right. By right and left, I mean justified.

Like this:

Topic title........user name|user name..........##|user name........Oct 22 2009

Thank you for the help.

EDIT: had to add the ...... for spaces, I don't want them in the tables :mrgreen:

mj1985
Registered User
Posts: 79
Joined: Sun Oct 18, 2009 9:11 pm

Re: top_five

Post by mj1985 »

Is there any chance to add the Hits and Replys from the threads to the "Last Posts" column?
I only wish to knew which text I have to paste in the code, the style I can do myself.
I modified this column, to get the last poster and not the topic opener.

My Site:
http://www.drhouse-forum.de/index.php

And sorry for bad english ;)
www.drhouse-forum.de - House MD Forum

Locked

Return to “[3.0.x] MOD Database Releases”