You are here

function Messaging_Message::set_user in Messaging 6.4

Same name and namespace in other branches
  1. 6.3 classes/messaging_message.class.inc \Messaging_Message::set_user()
  2. 7 messaging.message.inc \Messaging_Message::set_user()

Set user object and related properties

If not already set, method and destination will be searched for user account

1 call to Messaging_Message::set_user()
Messaging_Message::__set in includes/messaging_message.class.inc
Magic method, set protected properties

File

includes/messaging_message.class.inc, line 482
Drupal Messaging Framework - Message class file

Class

Messaging_Message
Message class

Code

function set_user($account) {
  parent::set_user($account);
  $this
    ->set_destination();

  // The send method can have some specific bits for user
  $this
    ->process_method('message_user');

  // Check we have method and address
  if (empty($this->method)) {
    $this
      ->set_error('Cannot find a suitable send method for this user.');
    return FALSE;
  }
  elseif (empty($this->destination)) {
    $this
      ->set_error('Cannot find a suitable address for this user.');
    return FALSE;
  }
  else {
    return !$this->discard;
  }
}