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.
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

mmontana wrote:Rich, I cleared the IE cache, including history, cookies, etc. I told the forum not to remember my login, logged out of the forum and closed IE. I opened the forum and clicked on one of the top five links. It took me right to the post without asking for a password or even making me login to the forum.
:?

That shouldn't be happening and I can't reproduce it.

Nailz, when you feel like it you can test this html. Copy it save it as top_five_body.html and upload it into your template folder for your style, then refresh the template/purge the cache in the ACP..

Code: Select all

<br clear="all" />
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="cat-head">  
	<tr>  
		<td width="182" align="left" valign="bottom"><img src="./styles/Provision_Red/theme/images/chl.png" width="182" height="31" border="0" alt="" /></td>  
		<td width="100%" align="left"><h4>Top Five</h4></td>  
		<td width="23" align="right"><img src="./styles/Provision_Red/theme/images/chr.png" width="23" height="31" border="0" alt="" /></td>  
	</tr>
</table>	
<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<td class="cat" width="40%"><h4>{L_NEWEST_TOPICS}</h4></td>
		<td class="cat" width="20%"><h4>{L_TOP_FIVE_ACTIVE}</h4></td>
		<td class="cat" width="40%"><h4>{L_TOP_FIVE_NEWEST}</h4></td>
	</tr>
	<tr>
		<td class="row1"><!-- BEGIN hot_topic_row --><span class="genmed"><a href="{hot_topic_row.U_TOPIC}">{hot_topic_row.TOPIC_TITLE}</a>&nbsp;{hot_topic_row.USERNAME_FULL}</span><br /><!-- END hot_topic_row --></td>
		<td class="row1"><!-- BEGIN top_five_active --><span class="genmed">{top_five_active.USERNAME_FULL} {L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a></span><br /><!-- END top_five_active --></td>
		<td class="row1"><!-- BEGIN top_five_newest --><span class="genmed">{top_five_newest.USERNAME_FULL} {L_JOINED}: {top_five_newest.REG_DATE}</span><br /><!-- END top_five_newest --></td>
	</tr>
	<tr>
		<td class="row4" colspan="2">&nbsp;</td>
	</tr>	
</table>
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
Nailz
Registered User
Posts: 125
Joined: Fri Nov 10, 2006 8:44 pm

Re: top_five

Post by Nailz »

Thanks so much RM, it could be my crap host, but off to work soon, so going to readd tomorrow with your style edit, thanks for helping and will post tomorrow if it worked out.
Shablo5
Registered User
Posts: 27
Joined: Tue Mar 31, 2009 11:14 am

Re: top_five

Post by Shablo5 »

Uhm... I installed this mod with AutoMod, and ... Nothing happened.

My forums:
www.the-creed.com

I installed with Automod, no problems there. Refreshed my cache and template to no avail.
Any other suggestions?
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

What style are you using? If not prosilver nor subsilver2, you will have to add the html file to your style.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
Shablo5
Registered User
Posts: 27
Joined: Tue Mar 31, 2009 11:14 am

Re: top_five

Post by Shablo5 »

It is currently called TwilightBB.

I am 100%, completely NEW at all of this... AS you can see im having trouble with my current skin and such fitting my banner in there, just to give you an idea of how noobish I am.

Where can I find this HTML file and where do I insert it?
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

TwilightBB is a subsilver2 based style, so take the html file found in the mod download located in root/styles/subsilver2/template and upload it into styles/twilightBB/template on your forum.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
JasonWade
Registered User
Posts: 287
Joined: Mon Jun 05, 2006 9:22 am

Re: top_five

Post by JasonWade »

First of all let me say: great mod!

I got 2 questions though:
1) Does this mod take forumpermissions into account? Meaning if a new post is made in a certain forum a member doesn't have access to, will he or she see that new post in this mod?

2) Is it possible to change the active poster list, to for example the top 5 this month? And if that's possible, how would I do something like that?|

Thanks in advance :)
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

JasonWade wrote:First of all let me say: great mod!

I got 2 questions though:
1) Does this mod take forumpermissions into account? Meaning if a new post is made in a certain forum a member doesn't have access to, will he or she see that new post in this mod?
If the user doesn't have auths to view the forum, then the user won't see the new post.
2) Is it possible to change the active poster list, to for example the top 5 this month? And if that's possible, how would I do something like that?|

Thanks in advance :)
Yeah, that would be possible you would have to change this code from includes/top_five.php

Code: Select all

// 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, 5);

		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)
	   );
    }
to query the posts table based on a time constraint.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
JasonWade
Registered User
Posts: 287
Joined: Mon Jun 05, 2006 9:22 am

Re: top_five

Post by JasonWade »

Thanks for answering so quickly.

I absolutely have no idea how to change things like that though. Are you (or maybe somebody else reading this know more about stuff like this) willing to edit that code for me if it's not too much work though?
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

You can try this, I haven't tested it though

OPEN

includes/top_five.php

FIND

Code: Select all

// 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, 5);

		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)
	   );
    }
REPLACE WITH

Code: Select all

// an array of user types we dont' bother with
	// could add board founder (USER_FOUNDER) if wanted
	$ignore_users = array(USER_IGNORE, USER_INACTIVE);
	$now = time();
	$date_today = gmdate("Y-m-d", $now);
	list($year_cur, $month_cur, $day1) = split('-', $date_today);

	 // Start time for current month
	$month_start_cur	= gmmktime (0,0,0, $month_cur, 1, $year_cur);
	$month_start		= $month_start_cur;
	$month_end			= $now;
	// top five posters

	$sql = 'SELECT u.username, u.user_id, u.user_colour, COUNT(p.post_id) AS user_posts
		FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p
			WHERE ' . $db->sql_in_set('u.user_type', $ignore_users, true) . '
				AND u.user_id = p.poster_id
					AND p.post_time BETWEEN ' . $month_start . ' AND ' . $month_end . '
		GROUP BY u.user_id
		ORDER BY user_posts DESC';
	$result = $db->sql_query_limit($sql, 5);

	while ($row = $db->sql_fetchrow($result))
	{
		$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)
	   );
    }
    $db->sql_freeresult($result);
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
JasonWade
Registered User
Posts: 287
Joined: Mon Jun 05, 2006 9:22 am

Re: top_five

Post by JasonWade »

Thank you, I'll test it now and let you know if it works :)
JasonWade
Registered User
Posts: 287
Joined: Mon Jun 05, 2006 9:22 am

Re: top_five

Post by JasonWade »

It seems to have worked, thank you very much!
aot
Registered User
Posts: 23
Joined: Thu Apr 02, 2009 9:45 pm

Re: top_five

Post by aot »

Nice MOD, very easy to install and works great!
User avatar
Rikusaki
Registered User
Posts: 95
Joined: Mon Aug 11, 2008 2:24 am

Re: top_five

Post by Rikusaki »

Is there a way to make the colors alternate in the rows to make it look nicer? :oops:
User avatar
RMcGirr83
Former Team Member
Posts: 22106
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: top_five

Post by RMcGirr83 »

I'm sure there is, but I don't think it necessary.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺

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