Skip to content

Conversation

dhruvgoel92
Copy link
Contributor

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

@imkingdavid
Copy link
Contributor

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.

@dhruvgoel92
Copy link
Contributor Author

perhaps we could display NO POSTS instead of SELECT OPTION ?

@naderman
Copy link
Member

naderman commented Apr 8, 2012

I agree, it should display a text explaining that the user has no posts.

@naderman
Copy link
Member

naderman commented Apr 8, 2012

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.

@p
Copy link
Contributor

p commented Apr 9, 2012

Please research how this PR will interact with #600.

@naderman
Copy link
Member

naderman commented Apr 9, 2012

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.',
Copy link
Member

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.

@dhruvgoel92
Copy link
Contributor Author

@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 -->
Copy link
Member

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

@dhruvgoel92
Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Collaborator

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');

@p
Copy link
Contributor

p commented May 9, 2012

Some commit messages are missing PHPBB3-10308.

@p
Copy link
Contributor

p commented May 9, 2012

Patch seems to work as intended.

@travisbot
Copy link

This pull request fails (merged 24222d3e into a618e22).

@travisbot
Copy link

This pull request fails (merged e9796468 into 0488d70).

@dhruvgoel92
Copy link
Contributor Author

i think i need to rebase it on the current develop-olympus right?

@bantu
Copy link
Collaborator

bantu commented May 9, 2012

To fix the failing tests? No, this is a different problem. You can just ignore it for now.

@dhruvgoel92
Copy link
Contributor Author

Ohh.. okay.. i anyway rebased it on to current olympus. That wont be a problem i guess?

@travisbot
Copy link

This pull request fails (merged 5f6267b7 into 0488d70).

@travisbot
Copy link

This pull request fails (merged 8941c7c6 into 0488d70).

@travisbot
Copy link

This pull request fails (merged 7ac420fd into 0488d70).

@travisbot
Copy link

This pull request fails (merged feefce7f into 0488d70).

?>
Copy link
Contributor

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.

@travisbot
Copy link

This pull request fails (merged 4f793cb8 into 0488d70).

@travisbot
Copy link

This pull request fails (merged 89f19723 into 0488d70).

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
@travisbot
Copy link

This pull request fails (merged cf556f9 into 0488d70).

@@ -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 -->

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
@travisbot
Copy link

This pull request fails (merged 041b7be into 0488d70).

@naderman naderman merged commit 041b7be into phpbb:develop-olympus May 29, 2012
@dhruvgoel92 dhruvgoel92 deleted the ticket/10308 branch February 17, 2013 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants