Closed (fixed)
Project:
Privatemsg
Version:
4.7.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
11 Feb 2007 at 08:37 UTC
Updated:
25 Feb 2007 at 21:46 UTC
As it is, a user can send himself/herself a message. So far, that's not too bad.
The problem is, imo, when there's a link next to your post or comment to "write" to yourself.
There's only one line to change in the code :
/**
* Implementation of hook_link().
*/
function privatemsg_link($type, $node = 0, $main = 0) {
global $user;
static $access = array();
if (user_access('access private messages') && ($type == 'node' || $type == 'comment') && variable_get("privatemsg_link_$type", 0) && (isset($user->privatemsg_allow) ? $user->privatemsg_allow : 1)) {
if (!isset($access[$node->uid])) {
$author = user_load(array('uid' => $node->uid));
$access[$node->uid] = user_access('access private messages', $author) && $author->uid && (isset($author->privatemsg_allow) ? $author->privatemsg_allow : 1);
}
// if ($access[$node->uid]) {
if ($access[$node->uid] && ($node->uid != $user->uid)) {
return array(l(t('write to author'), 'privatemsg/msgto/'. $node->uid));
}
}
} So you change this line :
if ($access[$node->uid]) {
To that line :
if (($node->uid != $user->uid) && $access[$node->uid]) {
Comments
Comment #1
mindless commentedfixed in DRUPAL-4-7 and DRUPAL-5 branches.
Comment #2
(not verified) commented