Closed (fixed)
Project:
Privatemsg
Version:
6.x-1.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Jun 2010 at 22:56 UTC
Updated:
4 Aug 2016 at 19:23 UTC
Jump to comment: Most recent
Comments
Comment #1
berdirThat is part of the module since forever yes, and in 6.x-2.x-dev, it is configurable, so you either disabled it or are using content_profile. If the latter, then you need to something similiar as privatemsg is doing in hook_user, $op view: http://blog.worldempire.ch/api/function/privatemsg_user/6-2 for content_profile.
Comment #2
berdirComment #3
web506 commentedI am using core, can I just upgrade from one to the other overwritting or do I have to remove the other one first?
Comment #4
berdirNo idea what you mean, you don't need to upgrade anything if you are using profile.module.
If the user viewing the page is allowed to write the user to which the profile belongs, then there should be a link to write that user a message, unless you have disabled it at admin/settings/messages.
Comment #5
web506 commentedThanks it is working fine now. The only issue I am having is that if I set the contact link on user profiel evrybody has access to it, even people with no permission to use private message, so if they click that link they can send messages.
I am using Panels for the profile page. I was not able to locate a panel that will display this link ( contact this user ) any ideas on how to do it? thanks!
Comment #6
berdirErm.. when you're using panels, then you're *not* using profile.module to display the user profile. And then obviously, it doesn't work out of the box;)
Try the following php code, note that you might need to change $account to the name of profile user variable, panels should tell you how that's named.
Comment #8
bjsomers commentedHi,
I'm a total newbie, but would like to put that link on my profile panel. How would I implement that code? When I try to create a custom content pane it just shows the code as text in the block.
Thanks
Comment #9
berdirWell, you need to tell panels that this is PHP code, probably by using the PHP filter format.
Comment #10
john.campbell-higgens commentedHave tried to code above to add a link in a panel but it gives a link of:
http://drupaltest/messages/new/?destination=user/10
Which just presents the blank new private message. if I remove the ?destination=user/ section so you have
http://drupaltest/messages/new/10
This works, but not sure how to change the code, can anyone help.
Comment #11
pauljb commentedI checked the "Use context keywords" in Panels and used the following Full HTML format:
< a href="../messages/new/%user:uid" title="Send Private Message">Send private message
Comment #13
calefilm commentedI have a separate issue over here: http://drupal.org/node/1108544 that is a question about how to create a Send Message tab on User Profile. This issue is somewhat related but different. I would appreciate questions to both, if anyone has the time.
Regarding this thread and adding a simple link, I tried the code in #6
and when I click the link "Contact this user" i get: /messages/new/?destination=user%2F16%2Fmessage
(by the way, I changed "privatemsg" to "messages")
Where does panels tell me what variable to use?
I get the Write New Message page but the To: is empty
16 is the uid I'm trying to contact. So it is coming up, just in the wrong place.
My Steps
What I've done is add a Tab on the user/%uid profile page. It's a separate panel page: user/%uid/send-message with a Menu Tab: Send Message
Result A:
Ideally, I'd like to have a Tab on profile page, "Send Message" that links to: /messages/new/16
http://drupal.org/node/1108544
Result B:
But couldn't figure out how to add a tab that links to /messages/new/16 so I simply added new content with php code inside it. Now, a user clicks, "Send Message" Tab (which is a panel page), and sees the link below it, "Contact this user"
Comment #14
cwithout commentedTo anyone happening across this needing to accomplish the same thing, the code in #6 is not complete. If the $account variable isn't defined, you'll get a link to exactly what people are getting "/messages/new/?destination=user%2F16%2Fmessage".
That's because $account needs to have the account object for the user you want to be contacted when the link is clicked.
Here's one way you can get the user object. (This will work only on the user pages (/user/#).)
Comment #15
TelFiRE commented#11 would seem to be a simpler and better approach, storing PHP in the database is not really a good practice.
It would be really nice to just add a panels display item which had this link. Can't imagine it would be super tough.
Comment #16
ragavendra_bn commentedI am using display suite and used the below php or html using the custom field. It now works like a charm.