It took me hours to find this so I copied it here for the benefit of others. If I ever meet ptmkenny I'll buy him a drink :-) Another member noted that Author Pane would work, but I didn't want yet another module...
Posted by ptmkenny on March 29, 2012 at 6:14am
I am overriding my users' profile pages with Panels. I made a "Send a PM to this user" link using Views.
Here's what I did:
1. Create a view of users and fields.
2. Add a content pane.
3. Set "User: Uid" as the contextual filter. "Hide view" when the filter is not available. When the filter is available "Specify validation criteria" to be "User" and "only allow numeric UIDs."
4. Under pane settings, set argument input to "From context" and require the "User ID" from under User.
5. Under fields, remove the user name and add a "Privatemsg: Send privatemsg link" field.
6. Save the view.
You can now add this as a pane in Panels and it will give you a single link to place wherever you want. If you don't want to show the link on a user's own profile, you can adjust the visibility settings (in panels) to not show the link when the logged in user = viewed user.