diff --git a/privatemsg.module b/privatemsg.module index 995b97b..2cb4edc 100644 --- a/privatemsg.module +++ b/privatemsg.module @@ -1786,6 +1786,15 @@ function _privatemsg_validate_message(&$message, $form = FALSE) { $messages['warning'][] = $blocked['message']; } } + //do not send private messages to blocked users + foreach ($message->recipients as $key => $recipient) { + if (!$recipient->status) { + unset($message->recipients[$key]); + $messages['warning'][] = t('A message could not be sent because a user has already cancelled his/her account.'); + } + } } // Check again, give another error message if all recipients are blocked