I don't think the reply form should be shown on the message page if any of the users in the conversation have closed their accounts or been blocked. I realize that one could also argue that the reply form should not be shown only if all of the users have been blocked, since the conversation could continue without the blocked users.

This feature request is related to the issue here:
https://drupal.org/node/834706

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ptmkenny’s picture

Status: Active » Needs review
FileSize
1 KB
Berdir’s picture

That code is specific to users, that doesn't work, a recipient could also be a role.

What we need to check and what I thought we already did is simply if there are any valid recipients that we can write to.

If you look at privatemsg_form_reply(), you can see that it already does that and it even has logic to display the reasons why those users are blocked. So if the form is still displayed, you need to check why the check there isn't working.

ptmkenny’s picture

Status: Needs review » Needs work

Ok, thanks for the comment. I missed the function call that performed validation.

I tried implementing this a different way by adding the following lines to _privatemsg_get_allowed_recipients() to make sure that the user account isn't blocked:

    // Do not add users who are blocked by Drupal as recipients
    if (!$recipient->status) {
      continue;
    }

However, the reply form is still shown because of this code:

    if ($recipient->type == 'user' && $recipient->recipient == $user->uid) {
      // Skip putting author in the recipients list for now.
      // Will be added if he is the only recipient.
      $usercount++;
      continue;

If I delete the line $usercount++, the reply form is hidden correctly. Why is the user added as the only recipient?

ptmkenny’s picture

Status: Needs work » Closed (duplicate)

Closed as duplicate as per this comment: https://drupal.org/node/834706#comment-7493932