I performed the following steps with admin user.

Steps:
1. Create a user and enable its private messaging.
2. Come to the same user edit screen, it shows that private messaging is enabled. its ok.
3. Uncheck the checkbox and save. User will be disabled for private messaging.
4. Again come on user edit screen of same user , still check box remains checked but i have disabled the private messaging.(This is a bug)
5. When i uncheck the same checkbox and save,it gives sql error.(its also a bug).

But if provide right to disable private messaging to the newly created user's role then it dont happen.
So as per there is an issue with right checking.(while we display the disbaling section you are checking the rights for loggedin user but while saving it you are checking for the user to whom we are editing.
But as per me on both time rights should be checked for logged user that is admin not for user to whom to whom we are editing.)

If i disable a user for private messaging once and again come for editing user then it display checkbox checked and when i click on submit by making it unchecked ,it displays some error.

But if i also provide permission

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1.92 KB

Attaching a patch that would fix this. Please test.

Another fix might be to simply remove that check when another user is viewing it.

This setting is not meant to be used to disable access to privatemsg to someone. If you want to do that, you should remove the permission from that user to write private messages.

The reason for that is simple:

When a user has privatemsg disabled, he will see a notice about that, including a link to his profile where he can enable it again. If that isn't the case, this message is misleading.

So I'm wondering if we shouldn't instead simply remove that setting when editing the user profile from another user (and the user doesn't has permissions to change it himself, maybe?).

What do you think?

Status: Needs review » Needs work
Issue tags: -block user for privatemsg

The last submitted patch, remove_permission_check.patch, failed testing.

krishan.sharma’s picture

Status: Needs work » Needs review

#1: remove_permission_check.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, remove_permission_check.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review

#1: remove_permission_check.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +block user for privatemsg

The last submitted patch, remove_permission_check.patch, failed testing.

BenK’s picture

Berdir, do you want me to take a look at this patch or fix the test first? I'd also be fine with just removing the setting altogether if another user is trying to change it.

--Ben

berdir’s picture

No need to test it when the tests fail. I think we have two options here:

1. Don't show the setting for other users at all.

2. If the user does not have permission to disable privatemsg but it is disabled, don't show the "hey, privatemsg is disabled but you can enable it again here." warning message.

What do you think?

I think 2. would open up interesting possibilies to disable privatemsg for single users without having to do complicated role setups (for example a "blocked" role than can not write messages to any user with a role block rule by pm_block_user). And it shouldn't be too complicated to implement.

BenK’s picture

Yeah, I really like option 2. That's interesting because it allows privatemsg ability to be disabled temporarily (like if someone is abusing the feature or something). And this is much better than a hackish role setup to achieve the same thing.

So let's go for option 2... :-)

--Ben

ptmkenny’s picture

Potentially related issue (Could be dupe): http://drupal.org/node/1288994

ptmkenny’s picture

Status: Needs work » Postponed (maintainer needs more info)

A related issue was fixed. Please confirm this bug is still active:
https://drupal.org/node/1605190

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Since there has been no activity for a month, I'm closing.