You are here

function Messaging_Message::__construct in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 includes/messaging_message.class.inc \Messaging_Message::__construct()
  2. 7 messaging.message.inc \Messaging_Message::__construct()

Constructor, with predefined array of data

File

classes/messaging_message.class.inc, line 71
Drupal Messaging Framework - Default class file

Class

Messaging_Message
Message class

Code

function __construct($data = array()) {
  foreach ($data as $key => $value) {
    $this->{$key} = $value;
  }

  // Set logging option
  if (!isset($this->log)) {
    $this->log = variable_get('messaging_log', 0);
  }

  // If retrieved from store, populate some data
  if (!empty($this->mqid)) {
    $this->prepared = $this->method;
    $this->rendered = $this->method;
    if ($this->uid && empty($this->account)) {
      $this->account = messaging_load_user($this->uid);
    }
    if ($this->sender && empty($this->sender_account)) {
      $this->sender_account = messaging_load_user($this->sender);
    }
  }
}