-
-
Notifications
You must be signed in to change notification settings - Fork 987
[ticket/10308] disable retain/ delete posts option when deleting a user #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
IMO, the option should be removed in that case, not just disabled. But either way we should explain why the option is not available to be clicked in some cases. |
perhaps we could display NO POSTS instead of SELECT OPTION ? |
I agree, it should display a text explaining that the user has no posts. |
Actually another comment: In general it's a bad idea to let UI elements disappear without explanations because it will confuse users who expect to see the element there. So disabled elements are typically the better solution because they make clear that the option hasn't disappeared because of a bug, or is located somewhere else, but is in fact disabled intentionally. |
Please research how this PR will interact with #600. |
I don't think they interact, as long as poll votes always get deleted regardless of the choices in the select box. |
@@ -77,6 +77,7 @@ | |||
|
|||
'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.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if this language key already exists elswhere, I'm pretty sure it does. Please pick a unique name.
@naderman have fixed the language key. |
@@ -140,7 +140,10 @@ | |||
<legend>{L_DELETE_USER}</legend> | |||
<dl> | |||
<dt><label for="delete_type">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt> | |||
<dd><select id="delete_type" name="delete_type"><option class="sep" value="">{L_SELECT_OPTION}</option><option value="retain">{L_RETAIN_POSTS}</option><option value="remove">{L_DELETE_POSTS}</option></select></dd> | |||
<dd><select id="delete_type" name="delete_type"><option class="sep" value="">{L_SELECT_OPTION}</option><option value="retain"<!-- IF USER_POSTS == 0 --> disabled="disabled" class="disabled-option"<!-- ENDIF -->>{L_RETAIN_POSTS}</option><option value="remove"<!-- IF USER_POSTS == 0 --> disabled="disabled" class="disabled-option"<!-- ENDIF -->>{L_DELETE_POSTS}</option></select></dd> | |||
<!-- IF USER_POSTS == 0 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USER_POSTS does not contain the actual number of posts, but the displayed number. You can disable increasing USER_POSTS in certain forums. So this might be 0 even though the user has posts. You need to add a query to retrieve the actual number of posts in acp_users.php
any other improvements for this PR? |
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true/false instead of 1/0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, should probably just cast to boolean.
$user_row['user_has_posts'] = (bool) $db->sql_fetchfield('post_id');
Some commit messages are missing PHPBB3-10308. |
Patch seems to work as intended. |
i think i need to rebase it on the current develop-olympus right? |
To fix the failing tests? No, this is a different problem. You can just ignore it for now. |
Ohh.. okay.. i anyway rebased it on to current olympus. That wont be a problem i guess? |
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to amend the commits that added the newlines.
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
While deletng the user, if the user has no posts in addition to the options being disabled an added message is displayed. PHPBB3-10308
Language key has been changed and has been made more specific to avoid conflicts PHPBB3-10308
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
language key renamed to make its usability more clearer. PHPBB3-10308
introduces a hidden input field with retain posts as the mode in case user has no posts. PHPBB3-10308
instead of fetching all posts by user we limit the query to 1 to check if a user has posts or not PHPBB3-10308
makes user_row['user_has_posts'] boolean instead of 1 or 0. PHPBB3-10308
Language variable has be renamed for better understanding PHPBB3-10308
@@ -140,7 +140,12 @@ | |||
<legend>{L_DELETE_USER}</legend> | |||
<dl> | |||
<dt><label for="delete_type">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt> | |||
<dd><select id="delete_type" name="delete_type"><option class="sep" value="">{L_SELECT_OPTION}</option><option value="retain">{L_RETAIN_POSTS}</option><option value="remove">{L_DELETE_POSTS}</option></select></dd> | |||
<dd> | |||
<!-- IF USER_HAS_POSTS == 0 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the == 0 check? If it's a boolean == 0 can probably be omitted.
indentation is fixed and user_posts variable is compared as a boolean variable. PHPBB3-10308
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