Page 1 of 1

Change Recent topics to Recent replies?

Posted: 9. June 2010 01:51
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.

Re: Change Recent topics to Recent replies?

Posted: 9. June 2010 12:09
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';

Re: Change Recent topics to Recent replies?

Posted: 10. June 2010 01:30
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);

?>

Re: Change Recent topics to Recent replies?

Posted: 10. June 2010 15:55
by Marc
What is that R doing there:

Code: Select all

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

Re: Change Recent topics to Recent replies?

Posted: 10. June 2010 19:55
by Kyian
im using an older version of board3, but i could only find it 2 times in the file.

Re: Change Recent topics to Recent replies?

Posted: 10. June 2010 20:24
by Marc
This will only work with 1.0.5. Update your portal.

Re: Change Recent topics to Recent replies?

Posted: 11. June 2010 01:11
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.

Re: Change Recent topics to Recent replies?

Posted: 11. June 2010 10:31
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