[php]<?php
if( $profiledata['user_posts'] )
{
$lp_sql = query_forum_list(AUTH_READ, 'auth_read', 't.');
if ($lp_sql) $lp_sql = 'AND '.$lp_sql;
$sql = "SELECT p.post_id, p.post_time, t.topic_title
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
WHERE p.poster_id = " . $profiledata['user_id'] . "
AND t.topic_id = p.topic_id
$lp_sql
ORDER BY p.post_time DESC
LIMIT 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR,
'Could not query last post info', '', __LINE__, __FILE__, $sql);
}
$lp_row = $db->sql_fetchrow($result);
if( $lp_row['post_id'] )
{
$last_post = '<b>'.create_date($board_config['default_dateformat'],
$lp_row['post_time'], $board_config['board_timezone']);
$last_post .= '</b> ' .
$lang['in'] . ' <a href="'.
append_sid('viewtopic.'.$phpEx.'?p=' .
$lp_row['post_id'] . '#' . $lp_row['post_id']) . '">' .
$lp_row['topic_title']. '</a>';
}
else
{
$last_post = '<i>' . $lang['No_Posts'] . '</i>';
}
$db->sql_freeresult($result);
}
else
{
$last_post = '<i>' . $lang['No_Posts'] . '</i>';
}
?>[/php]
A potem 'LAST_POST' => $last_post, no i do template. W razie czego ktoś powinien Ci pomóc.
Uwagi moderatora Dabroz (dodane 20 Wrz 2006, 20:26):
Ostatnio edytowany przez Dabroz 20 Wrz 2006, 20:26, edytowano w sumie 3 razy