
Dieses kleine Snippet bewirkt das der erste Beitrag eines threads, vom UPI2DB, als editiert angezeigt wird, wenn der Status des Topics geändert wurde.
- Code: Alles auswählen
#
#-----[ OPEN ]----------------------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]----------------------------------------------------------------
#
# Note the original line will be much longer
$sql = "SELECT t.topic_id, t.topic_title, t.topic_poster, t.topic_info, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id,
#
#-----[ IN-LINE FIND ]--------------------------------------------------------
#
t.topic_vote
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------------------
#
, t.topic_first_post_id
#
#-----[ FIND ]----------------------------------------------------------------
#
$message = $lang['Topic_info_updated'] .'<br /><br />'. sprintf($lang['Click_return_topic'], '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id") .'">', '</a>') .'<br /><br />'. sprintf($lang['Click_return_forum'], '<a href="'. append_sid("viewforum.$phpEx?". POST_FORUM_URL ."=$forum_id") .'">', '</a>');
#
#-----[ BEFORE, ADD ]---------------------------------------------------------
#
//<!-- BEGIN Unread Post Information to Database Mod -->
if($board_config['upi2db_on'])
{
$sql = "SELECT post_id FROM " . UPI2DB_LAST_POSTS_TABLE . " WHERE post_id = " . $forum_topic_data['topic_first_post_id'];
if ($result = $db->sql_query($sql))
{
$id_vorhanden = $db->sql_numrows($result);
}
$db->sql_freeresult($result);
if ($id_vorhanden == 0)
{
$sql = "INSERT INTO " . UPI2DB_LAST_POSTS_TABLE . " (post_id, topic_id, forum_id, poster_id, post_edit_time, topic_type, post_edit_by) VALUES ('".$forum_topic_data['topic_first_post_id']."', '".$forum_topic_data['topic_id']."', '".$forum_topic_data['forum_id']."', '" . $userdata['user_id'] . "', '".time()."', '".$forum_topic_data['topic_type']."', '" . $userdata['user_id'] . "')";
}
else
{
$sql = "UPDATE " . UPI2DB_LAST_POSTS_TABLE . " SET post_edit_time = '" . time() . "', topic_type = '" . $forum_topic_data['topic_type'] . "', post_edit_by = '" . $userdata['user_id'] . "' WHERE post_id = " . $forum_topic_data['topic_first_post_id'];
}
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting (UPI2DB)', '', __LINE__, __FILE__, $sql);
}
}
//<!-- END Unread Post Information to Database Mod -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------------
#
# EoM
Ich selber finde diese Funktion zwar eher lästig als nützlich. Aber je nach Anwendungsgebiet des 'Add Status To Topic', mag es vielleicht sogar einen Sinn ergeben.
