hieronder code portal_body.tpl stukje dat van belang is
Code: Selecteer alles
//
// Last Post Block [Code was derived from Recent Topics by: Smartor] Thanks for all you taught me !!! :D
//
// Number of Last Posts (not Forum ID)
$CFG['number_last_post'] = '5';
//
// Excluding forums for Recent Topics, eg. '2,4,10' (note: Smartor's Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '';
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, f.forum_id, f.forum_name, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . FORUMS_TABLE . " AS f, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_last_post'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query last post information', '', __LINE__, __FILE__, $sql);
}
$number_last_post = $db->sql_numrows($result);
$last_post_row = array();
while ($row = $db->sql_fetchrow($result))
{
$last_post_row[] = $row;
}
for ($i = 0; $i < $number_last_post; $i++)
{
$template->assign_block_vars('last_post_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $last_post_row[$i]['post_id']) . '#' .$last_post_row[$i]['post_id'],
'L_TITLE' => $last_post_row[$i]['topic_title'],
'U_FORUMS' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $last_post_row[$i]['forum_id']) . '#' .$last_post_row[$i]['forum_name'],
'L_FORUMS' => $last_post_row[$i]['forum_name'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $last_post_row[$i]['user_id']),
'S_POSTER' => $last_post_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $last_post_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
//
// END - Last Post Block [Code was derived from Recent Topics by: Smartor] Thanks for all you taught me !!! :D
//
alvast bedankt voor jullie hulp