From 643970dce4710b1eebbeb86ff4ac0074c9bfe298 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Mon, 26 Mar 2012 22:59:35 +0530 Subject: [PATCH 01/10] [ticket/10308] disable retain/ delete posts option when deleting a user When deleting a user, it asks whether the posts by user should be retained or deleted. The selection should be disable if the user has no posts. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 9237e45daf..0eeb7cde8b 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -140,7 +140,7 @@ {L_DELETE_USER}

{L_DELETE_USER_EXPLAIN}
-
+

From 239e6016a308cd80135ebe9d7057c2eb102af29d Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Mon, 9 Apr 2012 02:21:45 +0530 Subject: [PATCH 02/10] [ticket/10308] Displays message to user if there are no posts. While deletng the user, if the user has no posts in addition to the options being disabled an added message is displayed. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 3 +++ phpBB/language/en/acp/users.php | 1 + 2 files changed, 4 insertions(+) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 0eeb7cde8b..b158995563 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -141,6 +141,9 @@


{L_DELETE_USER_EXPLAIN}
+ +
{L_NO_POSTS}
+

diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index eda9659795..928699fd11 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -77,6 +77,7 @@ $lang = array_merge($lang, array( 'MOVE_POSTS_EXPLAIN' => 'Please select the forum to which you wish to move all the posts this user has made.', + 'NO_POSTS' => 'The user has no posts.', 'NO_SPECIAL_RANK' => 'No special rank assigned', 'NO_WARNINGS' => 'No warnings.', 'NOT_MANAGE_FOUNDER' => 'You tried to manage a user with founder status. Only founders are allowed to manage other founders.', From 8f7e85604bb36679db1baa37588fc5e39a8b853f Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Wed, 11 Apr 2012 03:00:16 +0530 Subject: [PATCH 03/10] [ticket/10308] fixes language entity. Language key has been changed and has been made more specific to avoid conflicts PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/language/en/acp/users.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index b158995563..73be17c4c1 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -142,7 +142,7 @@


{L_DELETE_USER_EXPLAIN}
-
{L_NO_POSTS}
+
{L_USER_NO_POSTS}

diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 928699fd11..25e172e55c 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -77,7 +77,6 @@ $lang = array_merge($lang, array( 'MOVE_POSTS_EXPLAIN' => 'Please select the forum to which you wish to move all the posts this user has made.', - 'NO_POSTS' => 'The user has no posts.', 'NO_SPECIAL_RANK' => 'No special rank assigned', 'NO_WARNINGS' => 'No warnings.', 'NOT_MANAGE_FOUNDER' => 'You tried to manage a user with founder status. Only founders are allowed to manage other founders.', @@ -125,6 +124,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', + 'USER_NO_POSTS' => 'The user has no posts.', 'USER_OUTBOX_EMPTIED' => 'Successfully emptied user’s private message outbox.', 'USER_OUTBOX_EMPTY' => 'The user’s private message outbox was already empty.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', From 59177a86c4160a4879aaf77e602f91ccea0fb107 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 20 Apr 2012 17:11:07 +0530 Subject: [PATCH 04/10] [ticket/10308] fix language and user's total posts language modified to be clear and select box disappears in case no posts by user. user's total posts are fetched using a new query. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 8 +++++--- phpBB/includes/acp/acp_users.php | 8 ++++++++ phpBB/language/en/acp/users.php | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 73be17c4c1..e6a1411bbb 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -140,9 +140,11 @@ {L_DELETE_USER}


{L_DELETE_USER_EXPLAIN}
-
- -
{L_USER_NO_POSTS}
+
+ + {L_USER_NO_POSTS} + +

diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 363c900edc..1f0f053a85 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1009,6 +1009,13 @@ class acp_users $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); + $sql = 'SELECT COUNT(post_id) as user_total_posts + FROM ' . POSTS_TABLE . ' + WHERE poster_id = '. $user_id; + $result = $db->sql_query($sql); + $user_row['user_total_posts'] = (int) $db->sql_fetchfield('user_total_posts'); + $db->sql_freeresult($result); + $template->assign_vars(array( 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), @@ -1036,6 +1043,7 @@ class acp_users 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], + 'USER_TOTAL_POSTS' => $user_row['user_total_posts'], 'USER_INACTIVE_REASON' => $inactive_reason, )); diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 25e172e55c..7f3a3d2a48 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -124,7 +124,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', - 'USER_NO_POSTS' => 'The user has no posts.', + 'USER_NO_POSTS' => 'The user has no posts to retain or delete.', 'USER_OUTBOX_EMPTIED' => 'Successfully emptied user’s private message outbox.', 'USER_OUTBOX_EMPTY' => 'The user’s private message outbox was already empty.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', From faf232219ef3b7a5dcc3d22639d4005040b0d8ad Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 20 Apr 2012 23:11:55 +0530 Subject: [PATCH 05/10] [ticket/10308] renames language key to USER_NO_POSTS_DELETE language key renamed to make its usability more clearer. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/language/en/acp/users.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index e6a1411bbb..2a27cc2a63 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -142,7 +142,7 @@


{L_DELETE_USER_EXPLAIN}
- {L_USER_NO_POSTS} + {L_USER_NO_POSTS_DELETE}
diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 7f3a3d2a48..52b7a35eac 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -124,7 +124,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', - 'USER_NO_POSTS' => 'The user has no posts to retain or delete.', + 'USER_NO_POSTS_DELETE' => 'The user has no posts to retain or delete.', 'USER_OUTBOX_EMPTIED' => 'Successfully emptied user’s private message outbox.', 'USER_OUTBOX_EMPTY' => 'The user’s private message outbox was already empty.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', From cf303c34788b32e1c09f483e2760b77eff3e05ca Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Sat, 21 Apr 2012 14:29:21 +0530 Subject: [PATCH 06/10] [ticket/10308] fixes user deletion if no posts introduces a hidden input field with retain posts as the mode in case user has no posts. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 2a27cc2a63..fdc1d55855 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -142,7 +142,7 @@

{L_DELETE_USER_EXPLAIN}
- {L_USER_NO_POSTS_DELETE} + {L_USER_NO_POSTS_DELETE}
From 164054f0679caaa68fb8400d3469b1149022db29 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Sun, 22 Apr 2012 00:36:38 +0530 Subject: [PATCH 07/10] [ticket/10308] fixes sql query, limit it to 1 instead of fetching all posts by user we limit the query to 1 to check if a user has posts or not PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/includes/acp/acp_users.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index fdc1d55855..ea2700e5e4 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -141,7 +141,7 @@

{L_DELETE_USER_EXPLAIN}
- + {L_USER_NO_POSTS_DELETE}
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1f0f053a85..7565d43690 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1009,11 +1009,11 @@ class acp_users $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); $db->sql_freeresult($result); - $sql = 'SELECT COUNT(post_id) as user_total_posts + $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' WHERE poster_id = '. $user_id; - $result = $db->sql_query($sql); - $user_row['user_total_posts'] = (int) $db->sql_fetchfield('user_total_posts'); + $result = $db->sql_query_limit($sql, 1); + $user_row['user_has_posts'] = ($db->sql_fetchfield('post_id') ? 1 : 0); $db->sql_freeresult($result); $template->assign_vars(array( @@ -1043,7 +1043,7 @@ class acp_users 'USER_EMAIL' => $user_row['user_email'], 'USER_WARNINGS' => $user_row['user_warnings'], 'USER_POSTS' => $user_row['user_posts'], - 'USER_TOTAL_POSTS' => $user_row['user_total_posts'], + 'USER_HAS_POSTS' => $user_row['user_has_posts'], 'USER_INACTIVE_REASON' => $inactive_reason, )); From 23ea588880a6793b53f2f4da0eb0609bed3fc90c Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Wed, 9 May 2012 21:41:12 +0530 Subject: [PATCH 08/10] [ticket/10308] makes variable boolean makes user_row['user_has_posts'] boolean instead of 1 or 0. PHPBB3-10308 --- phpBB/includes/acp/acp_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7565d43690..70e08f79f2 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1013,7 +1013,7 @@ class acp_users FROM ' . POSTS_TABLE . ' WHERE poster_id = '. $user_id; $result = $db->sql_query_limit($sql, 1); - $user_row['user_has_posts'] = ($db->sql_fetchfield('post_id') ? 1 : 0); + $user_row['user_has_posts'] = (bool) $db->sql_fetchfield('post_id'); $db->sql_freeresult($result); $template->assign_vars(array( From cf556f92c91816f6aef9028d911b5584f08842af Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Wed, 9 May 2012 21:46:27 +0530 Subject: [PATCH 09/10] [ticket/10308] fixes language variable name Language variable has be renamed for better understanding PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/language/en/acp/users.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index ea2700e5e4..1969428e38 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -142,7 +142,7 @@

{L_DELETE_USER_EXPLAIN}
- {L_USER_NO_POSTS_DELETE} + {L_USER_NO_POSTS_TO_DELETE}
diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 52b7a35eac..785283faea 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -124,7 +124,7 @@ $lang = array_merge($lang, array( 'USER_GROUP_SPECIAL' => 'Pre-defined groups user is a member of', 'USER_LIFTED_NR' => 'Successfully removed the user’s newly registered status.', 'USER_NO_ATTACHMENTS' => 'There are no attached files to display.', - 'USER_NO_POSTS_DELETE' => 'The user has no posts to retain or delete.', + 'USER_NO_POSTS_TO_DELETE' => 'The user has no posts to retain or delete.', 'USER_OUTBOX_EMPTIED' => 'Successfully emptied user’s private message outbox.', 'USER_OUTBOX_EMPTY' => 'The user’s private message outbox was already empty.', 'USER_OVERVIEW_UPDATED' => 'User details updated.', From 041b7be77ecd4e52048b94b4e47ad8268716a032 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 11 May 2012 01:50:36 +0530 Subject: [PATCH 10/10] [ticket/10308] fixes indentation indentation is fixed and user_posts variable is compared as a boolean variable. PHPBB3-10308 --- phpBB/adm/style/acp_users_overview.html | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 1969428e38..e2dcdb6307 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -135,24 +135,24 @@ -
-
- {L_DELETE_USER} -
-

{L_DELETE_USER_EXPLAIN}
-
- - {L_USER_NO_POSTS_TO_DELETE} - -
- -
-

- - - {S_FORM_TOKEN} -

-
-
+
+
+ {L_DELETE_USER} +
+

{L_DELETE_USER_EXPLAIN}
+
+ +
+ + {L_USER_NO_POSTS_TO_DELETE} + +
+

+ + + {S_FORM_TOKEN} +

+
+