Code:###############################################
## Hack Title: Always show 'edited by'
## Hack Version: 0.0.3
## Author: Freakin' Booty ;-P
## Website: http://freakingbooty.no-ip.com
## Description: When a user edits a post, 'edited by' is always shown. Without this hack,
## 'edited by' is only shown after a reply has been posted.
## Also shows what user has edited the post.
## Compatibility: 2.0.4 - 2.0.11
##
## Installation Level: Easy
## Installation Time: 5-10 minutes
## Files To Edit: 3
## viewtopic.php
## includes/constants.php
## includes/functions_post.php
##
## Included Files: 1
## db_update.php
##
## History:
## 0.0.3: Fixed a bug where the data is input for the first time.
## 0.0.2: Now shows who exactly has edited the post, and how many times. On top also shows what the last
## post time was.
## 0.0.1: Initial release
##
## Author Notes:
## 0.0.2 is unreleased, so that is why there are no upgrade instructions or anything.
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ©2003-04 Freakin' Booty ;-P - Always show 'edited by' 0.0.3
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
#
#-----[ COPY ]--------------------------------------------
#
# Run this file once as an administrator and then delete it immediately
#
db_update.php => db_update.php
#
#-----[ OPEN ]--------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]--------------------------------------------
#
if ( $postrow[$i]['post_edit_count'] )
{
$l_edit_time_total = ( $postrow[$i]['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);
}
else
{
$l_edited_by = '';
}
#
#-----[ REPLACE WITH ]------------------------------------
#
$sql = "SELECT pe.*, u.username
FROM " . POSTS_EDIT_TABLE . " pe, " . USERS_TABLE . " u
WHERE pe.post_id = " . $postrow[$i]['post_id'] . "
AND pe.user_id = u.user_id
ORDER BY pe.post_edit_time DESC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain posts edit count information', '', __LINE__, __FILE__, $sql);
}
$l_edited_by = '';
while ( $row = $db->sql_fetchrow($result) )
{
$l_edit_time_total = ( $row['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total'];
$l_edited_by .= ( ($l_edited_by == '') ? '<br />' : '' ) . '<br />' . sprintf($l_edit_time_total, $row['username'], create_date($board_config['default_dateformat'], $row['post_edit_time'], $board_config['board_timezone']), $row['post_edit_count']);
}
#
#-----[ OPEN ]--------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]--------------------------------------------
#
define('POSTS_TABLE', $prefix.'_bbposts');
#
#-----[ AFTER, ADD ]-------------------------------------
#
define('POSTS_EDIT_TABLE', $prefix.'_bbposts_edit');
#
#-----[ OPEN ]--------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND, DELETE ]------------------------------------
#
$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
#
#-----[ FIND ]--------------------------------------------
#
$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
#
#-----[ INLINE, FIND & DELETE ]---------------------------
#
" . $edited_sql . "
#
#-----[ FIND ]--------------------------------------------
#
add_search_words('single', $post_id, stripslashes($post_message), stripslashes($post_subject));
#
#-----[ BEFORE, ADD ]-------------------------------------
#
if( $mode == 'editpost' )
{
$sql = "SELECT * FROM " . POSTS_EDIT_TABLE . "
WHERE post_id = $post_id
AND user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not retrieve post edit count information', '', __LINE__, __FILE__, $sql);
}
$sql = ( $row = $db->sql_fetchrow($result) ) ? "UPDATE " . POSTS_EDIT_TABLE . " SET post_edit_count = post_edit_count + 1, post_edit_time = $current_time WHERE post_id = $post_id AND user_id = " . $userdata['user_id'] : "INSERT INTO " . POSTS_EDIT_TABLE . " (post_id, user_id, post_edit_count, post_edit_time) VALUES ($post_id, " . $userdata['user_id'] . ", 1, $current_time)";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update post edit count information', '', __LINE__, __FILE__, $sql);
}
}
#
#----[ SAVE & CLOSE ALL FILES ]---------------------------
#
|