I wrote a hook on privatemsg_alter, as follows:

function mymodule_privatemsg_alter($sender, $receiver, $subject, $body, $format, $thread, $type) {
drupal_set_message("message sender = ".$sender);
drupal_set_message("message receiver = ".$receiver);
drupal_set_message("message subject = ".$subject);
drupal_set_message("message body = ".$body);
drupal_set_message("message format = ".$format);
drupal_set_message("message thread = ".$thread);
drupal_set_message("message type = ".$type);
...

Everything looks correct, except that the $thread variable always seems to be off. When I reply to a message, I would expect $thread to be equal to the message ID that I replied to. It's not. In some cases, it's off by 1, and in other cases, it refers to the farthest parent message ID (also off by 1).

I am testing this by sending private messages to myself, if that makes a difference.

Comments

berdir’s picture

Status: Active » Closed (won't fix)

I'm closing old issues since Privatemsg for Drupal 5 is not maintained anymore. I suggest you switch to Drupal 6 if possible, many of the reported issues are probably already resolved there and if not, you're welcome to open a new issue.