API:sendAlert
From MODx Wiki
API Function Definition:
sendAlert
- Versions
- > 0.9.5
- Return Values
- Success: null
- Fail: null
- Data Type
- void
- Object Hierarchy
- DocumentParser
void sendAlert(string $type, mixed $to, mixed $from, string $subject, string $msg[, $private= 0]);
Sends a message to a manager user's message box. $to and $from can be either the user id or the user account name.
[edit]
Examples
sendAlert('alert','john',1,'New text is ready','Hi John, please review the new document I posted!',1);
[edit]
Related Functions
[edit]
Function Source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 1957 |
function sendAlert($type, $to, $from, $subject, $msg, $private= 0) { $private= ($private) ? 1 : 0; $tbl= $this->dbConfig['dbase'] . "." . $this->dbConfig['table_prefix']; if (!is_numeric($to)) { // Query for the To ID $sql= "SELECT id FROM " . $tbl . "manager_users WHERE " . $tbl . "manager_users.username='$to';"; $rs= $this->dbQuery($sql); if ($this->recordCount($rs)) { $rs= $this->fetchRow($rs); $to= $rs['id']; } } if (!is_numeric($from)) { // Query for the From ID $sql= "SELECT id FROM " . $tbl . "manager_users WHERE " . $tbl . "manager_users.username='$from';"; $rs= $this->dbQuery($sql); if ($this->recordCount($rs)) { $rs= $this->fetchRow($rs); $from= $rs['id']; } } // insert a new message into user_messages $sql= "INSERT INTO " . $tbl . "user_messages ( id , type , subject , message , sender , recipient , private , postdate , messageread ) VALUES ( '', '$type', '$subject', '$msg', '$from', '$to', '$private', '" . time() . "', '0' );"; $rs= $this->dbQuery($sql); }
[edit]
