Recent topic 2

Forum rules
This forum is not for support requests.

Only post Modifications for Board3 Portal 1.0.x in this forum.
Locked

Topic author
pokkis
Active Member
Posts: 5
Joined: 5. February 2008 14:48

Recent topic 2

Post by pokkis »

I needed block which is showing latest replies, so i slightly modded Recent topic :o
Recent_topic2.php

Code: Select all

<?php
/**
*
* @package - Board3portal
* @version $Id: recent.php 99 2008-01-15 20:31:25Z kevin74 $
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) nickvergessen ( http://mods.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/
if (!defined('IN_PHPBB'))
{
   exit;
}
if (!defined('IN_PORTAL'))
{
   exit;
}
//
// Exclude forums
//
$sql_where = '';
if ($portal_config['portal_exclude_forums'])
{
	$exclude_forums = explode(',', $portal_config['portal_exclude_forums']);
	foreach ($exclude_forums as $i => $id)
	{
		if ($id > 0)
		{
			$sql_where .= ' AND forum_id <> ' . trim($id);
		}
	}
}
//
// Recent announcements
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . '
	WHERE topic_status <> ' . FORUM_LINK . '
		AND topic_approved = 1 
		AND ( topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ' )
		' . $sql_where . '
	ORDER BY topic_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'] . '&t=' . $row['topic_id'])
		));
	}
}
$db->sql_freeresult($result);

//
// Recent hot topics
//
$sql = 'SELECT topic_title, forum_id, topic_id
	FROM ' . TOPICS_TABLE . '
	WHERE topic_approved = 1 
		AND topic_replies >=' . $config['hot_threshold'] . '
		' . $sql_where . '
	ORDER BY topic_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'] . '&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 . '
	WHERE topic_status <> ' . FORUM_LINK . '
		AND topic_approved = 1 
		AND topic_type = ' . POST_NORMAL . '
		' . $sql_where . '
	ORDER BY topic_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);
//
// Recent active topic
//
    $sql = 'SELECT topic_title, forum_id, topic_id, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_id
    FROM ' . TOPICS_TABLE . ' 
       WHERE topic_status <> 2
          AND topic_approved = 1
       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('active_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'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']),
			'TOPIC_LASTPOSTBY' 	=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'TOPIC_LASTPOSTTIME' 	=> $user->format_date($row['topic_last_post_time'])
		));
	}	
}
$db->sql_freeresult($result);
$template->assign_vars(array(
	'S_DISPLAY_RECENT'			=> true,
));
?>
Recent2.html
This is done only for subsilver 2
<!-- IF .latest_topics -->
<table class="tablebg" cellspacing="1" width="100%">
<tr>
<th colspan="3">{L_RECENT_TOPIC}</th>
</tr>
<tr>
<!-- IF .latest_hot_topics --><td class="cat" ><strong>{L_RECENT_HOT_TOPIC}</strong></td>
<td class="cat">{L_LAST_POST}</td>
<td class="cat">{L_POST_BY_AUTHOR}</td>
<!-- ENDIF -->
</tr>
<!-- IF .active_topics -->
<!-- BEGIN active_topics -->
<tr>
<td class="row1" valign="top">
<small>
<a href="{active_topics.U_VIEW_TOPIC}" title="{active_topics.FULL_TITLE}">{active_topics.TITLE}</a>
</small>
</td>
<td class="row1" valign="top">
<small>
{active_topics.TOPIC_LASTPOSTTIME}
</small>
</td>
<td class="row1" valign="top">
<small>
{active_topics.TOPIC_LASTPOSTBY}
</small>
</td>
<!-- END active_topics -->
<!-- ENDIF -->
</tr>
</table>
<br style="clear:both" />
<!-- ENDIF -->

jasonwade
Active Member
Posts: 2
Joined: 8. March 2008 19:21

Re: Recent topic 2

Post by jasonwade »

nm.
Locked

Return to “board3 Portal v1.0.x - Modifications in Dev”