Change Recent topics to Recent replies?

Current Version: 1.0.6
Released: 09.01.10
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
Scatman_mv
Active Member
Posts: 9
Joined: 27. April 2010 03:03

Change Recent topics to Recent replies?

Post by Scatman_mv »

Your Portal Version: 1.0.5
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge
Boardlink: http://www.completervr.com

What have you done before the problem was there?
nothing

What have you already tryed to solve the problem?
haven't

Description and Message
Hi

I am wanting to change the Recent block from recent topic to recent replies.
So if a thread has been responded to recently, it will be at the top of the list, and filter down accordingly.

ultimately I would like 2 of the announcement blocks, but i see someone else asked for this with no joy.

Thank you.
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: Change Recent topics to Recent replies?

Post by Marc »

If you want the recent topics to be ordered by the recent replies, try this:

Open portal/block/recent.php

You will have to do the next edit 3 times:

Find:

Code: Select all

	ORDER BY topic_time DESC';
Replace with:

Code: Select all

	ORDER BY topic_last_post_time DESC';

Topic author
Scatman_mv
Active Member
Posts: 9
Joined: 27. April 2010 03:03

Re: Change Recent topics to Recent replies?

Post by Scatman_mv »

Did this change. But on purging cache and going to portal it's reporting
Parse error: syntax error, unexpected '}' in /home/complet0/public_html/portal/block/recent.php on line 71

Line 71 was never changed? :?:

Below is the recent block code.

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: recent.php 589 2009-12-04 21:11:16Z marc1706 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

//
// Exclude forums
//       ORDER BY to
$sql_where = '';
if ($portal_config['portal_recent_forum'] > 0)
{
	$exclude_forums = explode(',', $portal_config['portal_recent_forum']);
	
	$sql_where = ' AND ' . $db->sql_in_set('forum_id', $exclude_forums, ($portal_config['portal_exclude_forums']) ? true : false);
}

// Get a list of forums the user cannot read
$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));

// Determine first forum the user is able to read (must not be a category)
$sql = 'SELECT forum_id
	FROM ' . FORUMS_TABLE . '
	WHERE forum_type = ' . FORUM_POST;

$forum_sql = '';
if (sizeof($forum_ary))
{
	$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
	$forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true);
}

$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');

//
// Recent announcements
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . FORUM_LINK . '
		AND topic_approved = 1 
		AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ')
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
       ORDER BY topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_announcements', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}R
}
$db->sql_freeresult($result);

//
// Recent hot topics
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_approved = 1 
		AND topic_replies >=' . $config['hot_threshold'] . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
       ORDER BY topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_hot_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Recent topic (only show normal topic)
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . ' t
	WHERE topic_status <> ' . ITEM_MOVED . '
		AND topic_approved = 1 
		AND topic_type = ' . POST_NORMAL . '
		AND topic_moved_id = 0
		' . $sql_where . '' .  $forum_sql . '
       ORDER BY topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_topics']);

while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
{
	// auto auth
	if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
	{
		$template->assign_block_vars('latest_topics', array(
			'TITLE'			=> character_limit($row['topic_title'], $portal_config['portal_recent_title_limit']),
			'FULL_TITLE'	=> censor_text($row['topic_title']),
			'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

$template->assign_var('S_DISPLAY_RECENT', true);

?>
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: Change Recent topics to Recent replies?

Post by Marc »

What is that R doing there:

Code: Select all

   }R
}
$db->sql_freeresult($result);

Kyian
Active Member
Posts: 2
Joined: 9. October 2009 09:28
phpBB.com User: Kyian

Re: Change Recent topics to Recent replies?

Post by Kyian »

im using an older version of board3, but i could only find it 2 times in the file.
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: Change Recent topics to Recent replies?

Post by Marc »

This will only work with 1.0.5. Update your portal.

Topic author
Scatman_mv
Active Member
Posts: 9
Joined: 27. April 2010 03:03

Re: Change Recent topics to Recent replies?

Post by Scatman_mv »

Marc wrote:What is that R doing there:

Code: Select all

   }R
}
$db->sql_freeresult($result);
Haha, don't know.
But removing it fixed the problem :D

Thanks for your help.

Kyian
Active Member
Posts: 2
Joined: 9. October 2009 09:28
phpBB.com User: Kyian

Re: Change Recent topics to Recent replies?

Post by Kyian »

It acutally worked just fine, is there a way to add how many replys there are. So it would look like this

New Topic (14)
Second Topic (2)
ThirdTopic (52)

And so on, and so you will be send to the last page aswell :)

Regards
Locked

Return to “board3 Portal 1.0.x - English Support”