function privatemsg_load in Privatemsg 5
Same name and namespace in other branches
- 5.3 privatemsg.module \privatemsg_load()
3 calls to privatemsg_load()
- privatemsg_new_form_submit in ./
privatemsg.module - privatemsg_view in ./
privatemsg.module - Display a private message to a user.
- _privatemsg_send in ./
privatemsg.module
File
- ./
privatemsg.module, line 2479
Code
function privatemsg_load($message_id) {
global $user;
$sql = 'SELECT p.id, u.uid, u.name, p.author, p.timestamp, p.subject, p.message, p.newmsg, p.recipient, p.folder, p.format, p.thread, p.type FROM {privatemsg} p INNER JOIN {users} u ON p.author = u.uid WHERE p.id = %d';
$params = array(
$message_id,
);
if (!user_access('administer private messages')) {
$sql .= ' AND (recipient = %d OR author = %d)';
$params[] = $user->uid;
$params[] = $user->uid;
}
$result = db_query($sql, $params);
return db_fetch_object($result);
}