Er behebt 2 Fehler im Mod:
- Beim versuch den Autor des ersten Postings eines Topics (und somit den Topicautor) zu ändern, kommt es zu einer (SQL-)Fehlermeldung wodurch die Änderung nicht durchgeführt wird.
- Die Beitragszähler der betroffenen User werden nicht angepasst.
- Code: Alles auswählen
#
#----------[ OPEN ]-------------------------------------
#
changeuser.php
#
#----------[ FIND ]-------------------------------------
#
//----------------------
// * change poster
//----------------------
$sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username = '" . $newposter . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_NoUser'], '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$newposter_id = $row['user_id'];
$db->sql_freeresult($result);
$sql = "UPDATE " . POSTS_TABLE . " SET poster_id=" . $newposter_id . " WHERE post_id =" . $changeid;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_WrongID'], '', __LINE__, __FILE__, $sql);
}
//----------------------
// * change post counter
//----------------------
$sql = "SELECT poster_id FROM " . POSTS_TABLE . " WHERE post_id =" . $changeid;
if( ($result = $db->sql_query($sql)) )
{
$row = $db->sql_fetchrow($result);
$oldposter = $row['poster_id'];
$db->sql_freeresult($result);
$sql = "UPDATE " . USERS_TABLE . " SET user_posts=user_posts-1 WHERE user_id =" . $oldposter;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_Error'], '', __LINE__, __FILE__, $sql);
}
}
$sql = "UPDATE " . USERS_TABLE . " SET user_posts=user_posts+1 WHERE user_id = " . $newposter_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_Error'], '', __LINE__, __FILE__, $sql);
}
#
#----------[ REPLACE WITH ]-----------------------------
#
$sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username = '" . $newposter . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_NoUser'], '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$newposter_id = $row['user_id'];
$db->sql_freeresult($result);
//----------------------
// * change post counter
//----------------------
$sql = "SELECT poster_id FROM " . POSTS_TABLE . " WHERE post_id =" . $changeid;
if( ($result = $db->sql_query($sql)) )
{
$row = $db->sql_fetchrow($result);
$oldposter = $row['poster_id'];
$db->sql_freeresult($result);
$sql = "UPDATE " . USERS_TABLE . " SET user_posts=user_posts-1 WHERE user_id =" . $oldposter;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_Error'], '', __LINE__, __FILE__, $sql);
}
}
$sql = "UPDATE " . USERS_TABLE . " SET user_posts=user_posts+1 WHERE user_id = " . $newposter_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_Error'], '', __LINE__, __FILE__, $sql);
}
//----------------------
// * change poster
//----------------------
$sql = "UPDATE " . POSTS_TABLE . " SET poster_id=" . $newposter_id . " WHERE post_id =" . $changeid;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['ChgP_WrongID'], '', __LINE__, __FILE__, $sql);
}
#
#----------[ FIND ]-------------------------------------
#
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_poster=" . $newposter . " WHERE topic_id =" . $changetid;
#
#----------[ REPLACE WITH ]-----------------------------
#
$sql = "UPDATE " . TOPICS_TABLE . " SET topic_poster=" . $newposter_id . " WHERE topic_id =" . $changetid;
#
#----------[ SAVE AND CLOSE ALL FILES ]-----------------
#
# EoM