I am having problems with privatemsg_filter_add_tags and would love some insight.

I created a module which creates a privatemsg after a function completes. I want to tag that message with one of the tags I created.

$thread = privatemsg_new_thread(array($user), $title, $message);  // this works beautifully.
privatemsg_filter_add_tags($thread['message']->thread_id, $tag_id, $user); // this doesn't produce the desired results

When I send the message, and look at the message in the UI ( inbox ), there are no tags on the message.
When I look in the database pm_tags_index, there is the thread id, the uid, and tag id.

I double checked that I have a valid tag id, it adds to the db correctly ( seemingly ), why does it now appear in the Inbox with the tag on the thread?

I also checked that if I got the $user's inbox, and add the tag manually, it adds correctly, both in the UI and db. What I am I missing?


ravitheja’s picture

Issue summary: View changes

$msg_result = privatemsg_new_thread(array(user_load(uid)), $subject, html_entity_decode($message), array('author' => user_load(frmuid)));
will get message id;
$tag_ids = 3;
$account = user_load(uid);
privatemsg_filter_add_tags($msg_thread_id, $tag_ids, $account);