aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-05-14 00:40:20 +0200
committerAndreas Fischer <bantu@phpbb.com>2012-05-14 00:40:20 +0200
commitf3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e (patch)
tree5197957d1b922229ea14e7e2f21dae79fdc82e57 /phpBB/includes/functions_user.php
parent9b96c1fb78c1cfcbc57e2206cd5d6f24f0c5922c (diff)
parent86fa185a1ba4754b6c2dc9769b826aa9d57aa148 (diff)
downloadforums-f3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e.tar
forums-f3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e.tar.gz
forums-f3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e.tar.bz2
forums-f3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e.tar.xz
forums-f3d33bf9d7858ad6ed9d82f3f794f4ec0266d68e.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10605] Use database updater function _sql() instead of $db->sql_query() [ticket/10605] Put end of array on its own line because start of array is too. [ticket/10605] Add parameter documentation to phpbb_delete_user_pms [ticket/10605] Fix left join usage. [ticket/10605] Add a section for updating from 3.0.10 to schema updates. [ticket/10605] Fix syntax error in database updater. [ticket/10605] Reset user“s pm count to 0 when deleting his PMs [ticket/10605] Split query to be able to use indexes [ticket/10605] Rename $delete_rows to $delete_ids. [ticket/10605] Break long comment into multiple lines 80 chars short. [ticket/10605] Remove unnecessary $delete_ids array. [ticket/10605] Remove unnecessary array_keys calls on $delete_rows. [ticket/10605] Remove unused variable declarations. [ticket/10605] Turn $undelivered_user into a real array of counters. [ticket/10605] Use unset() instead of checking user_id over and over again. [ticket/10605] Prefix function with phpbb_ and use true instead of 1 [ticket/10605] Delete orphan private messages on update [ticket/10605] Check for orphan privmsgs when deleting a user
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php58
1 files changed, 4 insertions, 54 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 5b05c3a78d..9b102b7387 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -527,62 +527,12 @@ function user_delete($mode, $user_id, $post_username = false)
WHERE session_user_id = ' . $user_id;
$db->sql_query($sql);
- // Remove any undelivered mails...
- $sql = 'SELECT msg_id, user_id
- FROM ' . PRIVMSGS_TO_TABLE . '
- WHERE author_id = ' . $user_id . '
- AND folder_id = ' . PRIVMSGS_NO_BOX;
- $result = $db->sql_query($sql);
-
- $undelivered_msg = $undelivered_user = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $undelivered_msg[] = $row['msg_id'];
- $undelivered_user[$row['user_id']][] = true;
- }
- $db->sql_freeresult($result);
-
- if (sizeof($undelivered_msg))
+ // Clean the private messages tables from the user
+ if (!function_exists('phpbb_delete_user_pms'))
{
- $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
- WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg);
- $db->sql_query($sql);
- }
-
- $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . '
- WHERE author_id = ' . $user_id . '
- AND folder_id = ' . PRIVMSGS_NO_BOX;
- $db->sql_query($sql);
-
- // Delete all to-information
- $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . '
- WHERE user_id = ' . $user_id;
- $db->sql_query($sql);
-
- // Set the remaining author id to anonymous - this way users are still able to read messages from users being removed
- $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
- SET author_id = ' . ANONYMOUS . '
- WHERE author_id = ' . $user_id;
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
- SET author_id = ' . ANONYMOUS . '
- WHERE author_id = ' . $user_id;
- $db->sql_query($sql);
-
- foreach ($undelivered_user as $_user_id => $ary)
- {
- if ($_user_id == $user_id)
- {
- continue;
- }
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_new_privmsg = user_new_privmsg - ' . sizeof($ary) . ',
- user_unread_privmsg = user_unread_privmsg - ' . sizeof($ary) . '
- WHERE user_id = ' . $_user_id;
- $db->sql_query($sql);
+ include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
}
+ phpbb_delete_user_pms($user_id);
$db->sql_transaction('commit');