I am using the privatemsg module to send messages and mails with questions about plants. The subject is automatically filled in with the token of a node title, which is always a plantname. They always have 2 single quotes in their names and that is turned into ' when it comes in the subject field of the private message.

What can I do about that?

1 Answer 1


You may implement this: hook_privatemsg_message_presave_alter in you custom module and change the message's subject as you like.

Here is a code sample:

 * Implements hook_privatemsg_message_presave_alter().
function your_module_privatemsg_message_presave_alter(&$message) {
  // dsm($message); print out the $message contents
  $message->subject = "$message->subject"; // use single or double quotes

Tip: strip quotes from a string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.