Gewijzigd bericht als nieuw bericht weergeven.
Geplaatst: 09 aug 2005, 17:28
Is het mogelijk om als wanneer het laatste bericht word gewijzigd dit word weergeven als een nieuw bericht?
Nederlandstalige phpBB Support
https://www.phpbb.nl/forums/
Dat klopt. Het is natuurlijk ook alleen de bedoeling dat als het laatste bericht word gewijzigd met de 'wijzig' knop dat die opnieuw word geplaatst. Ander klopt de volgorde van een topic ook niet meer.Spambot schreef:Dat is precies wat ik bedoelde, maar werkt waarschijnlijk alleen als het laatst toegevoegde bericht wordt bewerkt?
Code: Selecteer alles
if ( $mode == 'reply' && $userdata['user_id'] != ANONYMOUS )
{
$poster_id = $userdata['user_id'];
$sql = "SELECT post_id, poster_id, post_time, MAX(post_time) FROM " . POSTS_TABLE . " WHERE topic_id = $topic_id GROUP BY post_time ORDER BY post_time DESC LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$post_id_last_row = $db->sql_fetchrow($result);
$post_id = $post_id_last_row['post_id'];
$current_time = time();
$difference_time = $current_time - $post_id_last_row['post_time'];
$hours = floor($difference_time/60/60);
$minutes = floor($difference_time/60%60);
$seconds = $difference_time%60;
$separator = ' \n\n[size=9][color=#999999]Added after';
if ( $hours != 0 ) $separator .= ' ' . $hours . ' hours';
if ( $minutes != 0 ) $separator .= ' ' . $minutes . ' minutes';
if ( $hours == 0 && $minutes == 0 ) $separator .= ' ' . $seconds . ' seconds';
$separator .= ':[/color][/size]\n\n ';
if ( $post_id_last_row['poster_id'] == $poster_id && ( $difference_time < ( $board_config['join_interval'] * 3600 ) ) )
{
$mode = 'editpost';
$sql = "SELECT post_text, bbcode_uid FROM " . POSTS_TEXT_TABLE . " WHERE post_id = $post_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$last_message_row = $db->sql_fetchrow($result);
$bb_uid = ':' . $last_message_row['bbcode_uid'];
// i don't know much about parsing the message, so it may well be that,
// there are some wrongs, anyway all seems to work fine
$last_message = str_replace($bb_uid, '', $last_message_row['post_text']);
$last_message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $last_message);
$last_message = undo_htmlspecialchars(addslashes($last_message));
}
}