function Messaging_Message::set_user in Messaging 6.3
Same name and namespace in other branches
- 6.4 includes/messaging_message.class.inc \Messaging_Message::set_user()
- 7 messaging.message.inc \Messaging_Message::set_user()
Set destination user and find method's destination for this user if not set
Parameters
$account: User account object
$destination: Optional destination
File
- classes/
messaging_message.class.inc, line 239 - Drupal Messaging Framework - Default class file
Class
- Messaging_Message
- Message class
Code
function set_user($account, $destination = NULL) {
$this->uid = $account->uid;
$this->account = $account;
// Set destination if needed
if (isset($destination)) {
$this->destination = $destination;
}
elseif (!isset($this->destination)) {
$this->destination = messaging_user_destination($account, $this->method);
}
// Set user language if not set
if (!isset($this->language) && ($preferred = user_preferred_language($account))) {
$this->language = $preferred->language;
}
}