bonfils <kim@bonfils.your.underwear.com> wrote:
> Okay, jeg har godt nok ingen erfaring med phpBB, men da ingen andre har
> svaret, vil jeg komme med et hurtigt gæt:
> Det lyder umiddelbart som en reference-fejl. Har jeg ret i, at brugere
> bliver gemt i en tabel og indlæg i en anden - og at indlæg matches mod
> brugerne vha. et bruger-id?
> Når brugerne slettes, vil indlæggene da stadig eksistere (det er derfor
> de bliver listet på forsiden) - men de vil være "hjemløse", da deres
> brugere ikke længere findes. Derfor bliver de ikke vist, når man prøver
> at joine brugere og indlæg.
> At brugerne sig selv igen, løser nok ikke problemet, da de sandsynligvis
> vil de blive tildelt ny id'er.
> Hvis du ved, hvem der har skrevet hvad, kan du måske selv fixe det ved
> manuelt at rette de ny bruger-id'er, så de matcher til de gamle indlæg?
> Som sagt: Bare et gæt.
jeg har fundet noget kode for fjernelse af brugere i phpbb.:
hvis nogen kan fortælle på dansk, hvilke tabeller jeg skal gå ind i, og
slette ting.
Håber at nogen kan hjælpe..
if( $HTTP_POST_VARS['deleteuser'] && ( $userdata['user_id'] != $user_id
) )
{
$sql = "SELECT g.group_id
FROM " . USER_GROUP_TABLE . " ug, " .
GROUPS_TABLE . " g
WHERE ug.user_id = $user_id
AND g.group_id = ug.group_id
AND g.group_single_user = 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not
obtain group information for this user', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$sql = "UPDATE " . POSTS_TABLE . "
SET poster_id = " . DELETED . ",
post_username = '" . str_replace("\\'", "''",
addslashes($this_userdata['username'])) . "'
WHERE poster_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
update posts for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_poster = " . DELETED . "
WHERE topic_poster = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
update topics for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . VOTE_USERS_TABLE . "
SET vote_user_id = " . DELETED . "
WHERE vote_user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
update votes for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT group_id
FROM " . GROUPS_TABLE . "
WHERE group_moderator = $user_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not
select groups where user was moderator', '', __LINE__, __FILE__, $sql);
}
while ( $row_group = $db->sql_fetchrow($result)
)
{
$group_moderator[] =
$row_group['group_id'];
}
if ( count($group_moderator) )
{
$update_moderator_id = implode(', ',
$group_moderator);
$sql = "UPDATE " . GROUPS_TABLE . "
SET group_moderator = " .
$userdata['user_id'] . "
WHERE group_moderator IN
($update_moderator_id)";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR,
'Could not update group moderators', '', __LINE__, __FILE__, $sql);
}
}
$sql = "DELETE FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = $user_id";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete user from user_group table', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . GROUPS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete group for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
WHERE group_id = " . $row['group_id'];
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete group for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete user from topic watch table', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_userid = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete user from banlist table', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete sessions for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_KEYS_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not
delete auto-login keys for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT privmsgs_id
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_from_userid = $user_id
OR privmsgs_to_userid =
$user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not
select all users private messages', '', __LINE__, __FILE__, $sql);
}
// This little bit of code directly from the
private messaging section.
while ( $row_privmsgs =
$db->sql_fetchrow($result) )
{
$mark_list[] =
$row_privmsgs['privmsgs_id'];
}
if ( count($mark_list) )
{
$delete_sql_id = implode(', ',
$mark_list);
$delete_text_sql = "DELETE FROM " .
PRIVMSGS_TEXT_TABLE . "
WHERE privmsgs_text_id IN
($delete_sql_id)";
$delete_sql = "DELETE FROM " .
PRIVMSGS_TABLE . "
WHERE privmsgs_id IN
($delete_sql_id)";
if ( !$db->sql_query($delete_sql) )
{
message_die(GENERAL_ERROR,
'Could not delete private message info', '', __LINE__, __FILE__,
$delete_sql);
}
if ( !$db->sql_query($delete_text_sql) )
{
message_die(GENERAL_ERROR,
'Could not delete private message text', '', __LINE__, __FILE__,
$delete_text_sql);
}
}
$message = $lang['User_deleted'] . '<br /><br
/>' . sprintf($lang['Click_return_useradmin'], '<a href="' .
append_sid("admin_users.$phpEx") . '">', '</a>') . '<br /><br />' .
sprintf($lang['Click_return_admin_index'], '<a href="' .
append_sid("index.$phpEx?pane=right") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
--
Jeg har talt
|