For the first time I'm trying to hack a module. I'm not a programmer, and I'm very glad I could make a little customization to this module.
Besides another small hack, I simply added a class to messages being sent, by changing line 822 of send.inc from:
<?php
$body = $values['node_body'];
?>to:
<?php
$body = '<div class="sent-nodes">'.$values['node_body'].'</div>'; // <------ Add a class to sent messsages
?>And it worked. Now I'd like to add a link at the end of the message telling recipients to visit the site if they want to comment. Something like this:
<?php
$body = '<div class="sent-nodes">'.$values['node_body'].'</div>'. '<br /><a href="/comment/reply/'. $node->nid.'#comment-form">Click here to leave a comment on our site about this message.</a>'; // <------ Add a class to sent messsages and a link to comment
?>
But $node->nid is not being printed (the link I get is http://site.com/comment/reply/#comment-form). What should write to get that link working?
Additionally, if someone would give me some advice on a better way to write these hacks (if any), I'd appreciate, as I never studied PHP and I'm learning only from my own mistakes.
Thanks.
Comments
Comment #1
dtabach commentedFound an answer. You first have to load the node, then retrieve its nid.
So, The last chunk of code would be like this
Now it's working. Anyway, I'm still accepting advices about this hack. Could it damage anything? Is there a better way to do it?
Comment #2
stevensurowiec commentedYou would be better off doing
instead since that uses the nid passed into the function instead of assuming it is always in the same place in the url.