function messaging_simple_get_messages in Messaging 6.4
Same name and namespace in other branches
- 6.3 messaging_simple/messaging_simple.module \messaging_simple_get_messages()
- 7 messaging_simple/messaging_simple.module \messaging_simple_get_messages()
Get messages for user or destination
Parameters
$params: Array of integer parameters
1 call to messaging_simple_get_messages()
- messaging_simple_user_overview in messaging_simple/
messaging_simple.module - Display message overview list
File
- messaging_simple/
messaging_simple.module, line 154 - Simple messaging using html page. Messaging method plug-in
Code
function messaging_simple_get_messages($params, $pager = MESSAGING_SIMPLE_PAGER) {
$where = array();
foreach ($params as $field => $value) {
$where[] = $field . ' = ' . (int) $value;
}
$sql = "SELECT * FROM {messaging_simple} WHERE " . implode(' AND ', $where) . " ORDER BY sent DESC";
$messages = array();
if ($pager) {
$result = pager_query($sql, $pager);
}
else {
$result = db_query($sql);
}
while ($message = db_fetch_object($result)) {
$messages[] = $message;
}
return $messages;
}