/** * Send Message */ public function sendMessage($h) { $result = $h->sendMessage($this->to, '', $this->subject, $this->body); if (is_array($result)) { // error array! $this->errors = $result; return false; } else { // must be the insert id: $this->id = $result; } // code here to call sendEmailNotification IF PERMITTED $recipient = new UserAuth(); $recipient_id = $h->getUserIdFromName($this->to); $recipient->getUserBasic($h, $recipient_id); $recipient_settings = $recipient->getProfileSettingsData($h, 'user_settings'); if ($recipient_settings['pm_notify']) { $this->sendEmailNotification($h); } return true; }