I thing that if i'm in my user page i shouldnt see the link : "Send this user a private message"
so here the "privatemsg_user_view" function edited:
function privatemsg_user_view($account) {
global $user;
if ($account->uid != $user->uid){
if (($url = privatemsg_get_link(array($account))) && variable_get('privatemsg_display_profile_links', 1)) {
$account->content['privatemsg_send_new_message'] = array(
'#type' => 'link',
'#title' => t('Send this user a private message'),
'#href' => $url,
'#weight' => 10,
'#options' => array(
'query' => drupal_get_destination(),
'title' => t('Send this user a private message'),
'attributes' => array('class' => 'privatemsg-send-link privatemsg-send-link-profile'),
),
);
}
}
}
Basically if the page author is the user uid, hide the form.
Hope this helps!
Bless
Comments
Comment #1
jasom commentedI agree, I should not see this message on my user page.
Comment #2
ptmkenny commentedComment #3
ptmkenny commentedComment #4
ptmkenny commentedHere's a patch with cavax's code. I added tests so that we can confirm the functionality works as intended over the long term.
Comment #6
ptmkenny commentedAttempt to fix test.
Comment #8
ptmkenny commentedAh, the test was failing because there are no periods in the link. D'oh!
Comment #9
ptmkenny commentedAnd here's a "tests only" patch.
Comment #11
ptmkenny commented$user1 needs "view user profiles" permission.
Comment #13
ptmkenny commented"access user profiles" not "view user profiles"-- didn't realize the UI and the code were different.
This patch includes cavax's code and two tests by me, one to confirm that a user with appropriate permissions does not see a "send user a privatemsg" link on his/her own profile page (the modified behavior), and another test to confirm that the user does see a link on other users' profile pages (the previous behavior).
Comment #14
ptmkenny commentedComment #15
berdir7.x-2.x has a setting for this, it's not needed there.
Comment #16
ptmkenny commentedOops, didn't realize that. Closing.