Hi,<br><br>I am looking to do a slight modification in my Drupal installation within the <font size="-1"><span class="a"><b>Private</b><span style="font-weight: bold;">msg </span>module.<br><br>Below my nodes, I added a contact author link and now I want to display the Title of the node within the Subject Field of the message.
<br><br>So first, I added the nid of the node in the URL of the message in order to be able to retrieve the title of the node:<br><font size="1">/**<br>&nbsp;* Implementation of hook_link().<br>&nbsp;*/<br>function privatemsg_link($type, $node = NULL, $teaser = FALSE) {
<br>&nbsp; global $user;<br>&nbsp; static $access = array();<br>&nbsp; $links = array();<br>&nbsp; $nid = $node-&gt;nid;<br>&nbsp; $uid = $node-&gt;uid;<br>&nbsp; if ($type == &#39;comment&#39; &amp;&amp; $node-&gt;nid) {<br>&nbsp;&nbsp;&nbsp; $node = node_load($node-&gt;nid);
<br>&nbsp; }<br>&nbsp; if (user_access(&#39;access private messages&#39;) &amp;&amp; in_array($teaser ? &#39;teaser&#39; : $type, variable_get(&#39;privatemsg_link_&#39;. $node-&gt;type, array())) &amp;&amp; $uid != $user-&gt;uid &amp;&amp; $user-&gt;privatemsg_allow) {
<br>&nbsp;&nbsp;&nbsp; if (!isset($access[$uid])) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $author = user_load(array(&#39;uid&#39; =&gt; $uid));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $access[$uid] = user_access(&#39;access private messages&#39;, $author) &amp;&amp; $author-&gt;uid &amp;&amp; $author-&gt;privatemsg_allow;
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if ($access[$uid]) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $links[&#39;privatemsg_write_to_author&#39;] = array(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;title&#39; =&gt; t(&#39;Write to seller&#39;),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;href&#39; =&gt; &#39;privatemsg/new/&#39;.$uid.&#39;/&#39;. $nid,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br>&nbsp; return $links;<br>}</font><br><br>But now I am unable to manage to modify properly this function and display the Title of the node within the Subject Field of the message:<br><font size="1">
/**<br>&nbsp;* Provides a form to write a private message.<br>&nbsp;*/<br><span style="font-weight: bold;">function privatemsg_new_form() </span>{<br>&nbsp; global $user;<br>&nbsp; $message = 0;<br><br>&nbsp; $op = arg(1);<br>&nbsp; if ($op == &#39;reply&#39;) {
<br>&nbsp;&nbsp;&nbsp; $message = arg(2);<br>&nbsp; }<br>&nbsp; else if (($uid = arg(2)) &amp;&amp; ($msg-&gt;recipient = db_result(db_query(&#39;SELECT name FROM {users} WHERE uid = %d&#39;, $uid)))) {<br>&nbsp;&nbsp;&nbsp; $message = $msg;<br>&nbsp; }<br><br>&nbsp; if ($message &amp;&amp; !is_object($message)) {
<br>&nbsp;&nbsp;&nbsp; // This is a reply to another message<br>&nbsp;&nbsp;&nbsp; $message = db_fetch_object(db_query(&#39;SELECT thread, subject, message, <a href="http://u.name">u.name</a> AS recipient FROM {privatemsg} p INNER JOIN {users} u ON u.uid
 = p.author WHERE id = %d AND recipient = %d&#39;, $message, $user-&gt;uid));<br><br>&nbsp;&nbsp;&nbsp; if (!stristr($message-&gt;subject, t(&#39;Re:&#39;))) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;subject = t(&#39;Re:&#39;) .&#39; &#39;. $message-&gt;subject;
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; <br>&nbsp;&nbsp;&nbsp; // quoting; [quote] if default input format uses bbcode or quote, else &gt; quoting<br>&nbsp;&nbsp;&nbsp; foreach (filter_list_format(filter_resolve_format(FILTER_FORMAT_DEFAULT)) as $filter) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($filter-&gt;module == &#39;bbcode&#39; || $filter-&gt;module == &#39;quote&#39;) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bbcode = TRUE;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (isset($bbcode)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;message = &quot;\n\n[quote=&quot;. $message-&gt;recipient .&#39;]&#39;. $message-&gt;message .&#39;[/quote]&#39;;
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;message = &quot;\n\n\n&quot;. str_replace(&quot;\n&quot;, &quot;\n&gt; &quot;, &quot;\n&quot;. $message-&gt;message);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br><br>&nbsp; if (isset($_SESSION[&#39;recipients&#39;])) {
<br>&nbsp;&nbsp;&nbsp; $recipient = implode(&#39;, &#39;, $_SESSION[&#39;recipients&#39;]);<br>&nbsp;&nbsp;&nbsp; unset($_SESSION[&#39;recipients&#39;]);<br>&nbsp; }<br>&nbsp; <br><br>&nbsp; $form = array(&#39;preview&#39; =&gt; array());<br><br>&nbsp; $form[&#39;thread&#39;] = array(&#39;#type&#39; =&gt; &#39;value&#39;, &#39;#value&#39; =&gt; isset($message-&gt;thread) ? $message-&gt;thread : 0);
<br>&nbsp; $form[&#39;header&#39;][&#39;#theme&#39;] = &#39;privatemsg_new_msg_header&#39;;<br>&nbsp; $form[&#39;header&#39;][&#39;recipient&#39;] = array(<br>&nbsp;&nbsp;&nbsp; &#39;#type&#39; =&gt; &#39;hidden&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;#title&#39; =&gt; t(&#39;Purchase&#39;),
<br>&nbsp;&nbsp;&nbsp; &#39;#description&#39; =&gt; t(&#39;Separate multiple names with commas.&#39;),<br>&nbsp;&nbsp;&nbsp; &#39;#default_value&#39; =&gt; isset($recipient) ? $recipient : $message-&gt;recipient,<br>&nbsp;&nbsp;&nbsp; &#39;#autocomplete_path&#39; =&gt; &#39;privatemsg/autocomplete&#39;,
<br>&nbsp;&nbsp;&nbsp; &#39;#size&#39; =&gt; 50,<br>&nbsp;&nbsp;&nbsp; &#39;#maxlength&#39; =&gt; 1000,<br>&nbsp; );<br><br><font style="font-weight: bold;" size="1">&nbsp; $form[&#39;header&#39;][&#39;subject&#39;] = array(<br>&nbsp;&nbsp;&nbsp; &#39;#type&#39; =&gt; &#39;textfield&#39;,
<br>&nbsp;&nbsp;&nbsp; &#39;#title&#39; =&gt; t(&#39;Subject&#39;),<br>&nbsp;&nbsp;&nbsp; &#39;#default_value&#39; =&gt; $message-&gt;subject,<br>&nbsp;&nbsp;&nbsp; &#39;#size&#39; =&gt; 50,<br>&nbsp;&nbsp;&nbsp; &#39;#maxlength&#39; =&gt; 64,<br>&nbsp; );<br><br></font>&nbsp; $form[&#39;privatemsgbody&#39;] = array(
<br>&nbsp;&nbsp;&nbsp; &#39;#type&#39; =&gt; &#39;textarea&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;#title&#39; =&gt; t(&#39;Message&#39;),<br>&nbsp;&nbsp;&nbsp; &#39;#default_value&#39; =&gt; $message-&gt;message,<br>&nbsp;&nbsp;&nbsp; &#39;#cols&#39; =&gt; 80,<br>&nbsp;&nbsp;&nbsp; &#39;#rows&#39; =&gt; 6,
<br>&nbsp; );<br>&nbsp; $form[] = filter_form($message-&gt;format);<br>&nbsp; $form[] = array(<br>&nbsp;&nbsp;&nbsp; &#39;#type&#39; =&gt; &#39;submit&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;#value&#39; =&gt; t(&#39;Preview&#39;)<br>&nbsp; );<br>&nbsp; $form[] = array(<br>&nbsp;&nbsp;&nbsp; &#39;#type&#39; =&gt; &#39;submit&#39;,
<br>&nbsp;&nbsp;&nbsp; &#39;#value&#39; =&gt; t(&#39;Send private message&#39;)<br>&nbsp; );<br>&nbsp; $form[&#39;#after_build&#39;] = array(&#39;_privatemsg_new_preview&#39;);<br><br>&nbsp; drupal_add_js(drupal_get_path(&#39;module&#39;, &#39;privatemsg&#39;) .&#39;/privatemsg.js&#39;);
<br><br>&nbsp; return $form;<br>}</font><br><br>Any help to get this modification done would be greatly appreciated!<br><br>Thanks,<br><br>Antoine<br></span></font>