You are here

function privatemsg_message_allowed in Privatemsg 5.3

Same name and namespace in other branches
  1. 5 privatemsg.module \privatemsg_message_allowed()
3 calls to privatemsg_message_allowed()
privatemsg_new_form in ./privatemsg.module
Provides a form to write a private message.
privatemsg_user in ./privatemsg.module
Implementation of hook_user().
_privatemsg_send in ./privatemsg.module

File

./privatemsg.module, line 461

Code

function privatemsg_message_allowed($recipient, $author = NULL) {
  global $user;
  $author = $author ? $author : $user->uid;
  $account = user_load(array(
    'uid' => $recipient,
  ));
  if (privatemsg_user_blocked($author, $recipient)) {
    return FALSE;
  }
  if (isset($account->privatemsg_allow) && !$account->privatemsg_allow) {
    return FALSE;
  }
  return TRUE;
}