offline
- Pridružio: 20 Jun 2007
- Poruke: 30
|
Nasao sam nesto sto je nalik ovome sto trazim...
Dakle: Da dva uzastopna posta istog korisnika spoji u jedan.
Evo koda:
The mod (2 versions):
Version 2 (perfect version):
File: modules/Forums/posting.php
Replace:
Citat:
prepare_post($mode, $post_data, $bbcode_on, $html_on, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length);
With:
Citat:
//
//Mod by Yuet @ inbrite.com
//
if ($mode == 'reply') {
$sql = "SELECT p.poster_id, p.post_id, t.post_text FROM (".POSTS_TABLE." p, ".POSTS_TEXT_TABLE." t) WHERE p.post_id = t.post_id AND p.topic_id='$topic_id' ORDER BY p.post_time DESC LIMIT 1";
$result = $db->sql_query($sql);
list($lastposter, $lastpost, $lasttext) = $db->sql_fetchrow($result);
if ($lastposter == $userdata['user_id']) {
$mode = "editpost";
$post_id = $lastpost;
$old_message = $lasttext;
$message =$old_message."\n\n********************\n".$message;
}
}
prepare_post($mode, $post_data, $bbcode_on, $html_on, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length);
=========================
Version 1 (with post count bug):
File: includes/phpBB/function_posts.php
Replace:
Citat:
$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text) VALUES ($post_id, '$post_subject', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', post_subject = '$post_subject' WHERE post_id = $post_id";
$db->sql_query($sql);
With:
Citat:
//Mod by Yuet @ inbrite.com
if ($mode == 'reply') {
$sql = "SELECT p.poster_id, p.post_id, t.post_text FROM (".POSTS_TABLE." p, ".POSTS_TEXT_TABLE." t) WHERE p.post_id = t.post_id AND p.topic_id='$topic_id' ORDER BY p.post_time DESC LIMIT 1";
$result = $db->sql_query($sql);
list($lastposter, $lastpost, $lasttext) = $db->sql_fetchrow($result);
if ($lastposter == $userdata['user_id']) {
$post_id = $lastpost;
$old_message = $lasttext;
$post_message = str_replace("'", "\\'", $old_message."\n\n********************\n".$post_message);
$sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', post_subject = '$post_subject' WHERE post_id = $post_id";
$db->sql_query($sql);
$sql = "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig, post_edit_time = $current_time, post_edit_count = post_edit_count + 1 WHERE post_id = $post_id";
} else {
$sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text) VALUES ($post_id, '$post_subject', '$post_message')";
}
} else {
$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text) VALUES ($post_id, '$post_subject', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', post_subject = '$post_subject' WHERE post_id = $post_id";
}
$db->sql_query($sql);
Dopuna: 19 Okt 2007 13:08
Eto ljudi, ja sa Vama podelio kod (heh, k`o da vi to vec nemate ), aj` molim Vas sad pomognete vi meni.
Ne bez zezanja, stvarno mi treba pomoc! Ubacio sam onaj prvi kod (gore) i sve lepo radi, spaja on uzastopne postove istog korisnika, ali postoji jedna stvar koja mi se ne svidja...Kada spoji dva posta, ne prikaze to kao novu poruku!
Moze li neko da pomogne? Sta i gde da dodam da bi i posle dopune prikazivao taj post kao nov (neprocitan)???
Dopuna: 22 Okt 2007 11:47
heh...bar napisite da ignorisete ovu temu da ne gledam svaki dan ima li novih postova...
|