Hi there! Hope everyone's doing good today! :-)

I'm trying to figure out how to add a link at the end of a node that lets a person send a private message to the owner of the node.

I'm kinda uncertain as to how to make this happen... but I'll just post my thoughts and (hopefully, any solutions! :-) here)

Basically, this is what I've done so far. I've taken the $output variable and added onto it like this:

$output .= t('<p>Please contact <a href="/%privatemsg/msgto/$user->uid">the node owner</a> to find out more.');

However,

(1) I know that I need to change the $user->uid to the node owner's (not the person logged in and looking at the node) and,

(2) I need to fix the formatting inside the link, 'cause right now, it's not linking correctly.

Any advice? Thanks everyone!

Albert
www.ithou.org

Comments

Muslim guy’s picture

Thought that PRIVATEMESSAGE.module will do the thing?

With option to `send prvt msg to author (write to author)' link at the end of a node

Internet for ISLAM, get to know Islam and Muslims :) May Allah brings you to the Straight Path
http://muslimin.org/Islam

ajwwong’s picture

That's great! You just saved me another 5 hours of work... :-)

Thanks so much.

Peace,
Albert
www.ithou.org

[Edit: PS. With your help, Muslimin, I was able to find the part in privatemsg.module that I wanted and made the following hack addition to my $output string... in case anyone is interested in doing this themselves....

 $output .= t('<p>Please contact %send_msg_to to find out more.',array('%send_msg_to' => l(t('provider'), "privatemsg/msgto/$node->uid")));

This does the trick!]

Muslim guy’s picture

The privatemsg.module did not work with our site:( Drupal 4.6.5

Maybe we got to have the updated module - has it been updated?

tom-knox’s picture

Anyway i could put this code or a version of it into a block and put it on node pages?