privatemsg_message_load() returns a bunch of data about the message, but no recipient_id. So, using privatemsg_message_load() , how do I make sure that the recipient and author of a particular message are the only ones who can view that messsage (without having to query the db specifically for that)? Passing the $account argument doesn't help.

http://api.worldempire.ch/api/privatemsg/privatemsg.module/function/priv...

Thanks

Comments

ptmkenny’s picture

Category: feature » support
work77’s picture

Is my question dumb in a way I don't realize? Please let me know and I'll change it up. Suggestions anyone?

ptmkenny’s picture

Sorry, I'm not an expert on the API, but it might be helpful if you could explain why you want to use privatemsg_message_load()?

ptmkenny’s picture

You might actually want privatemsg_thread_load(), though there is a bug noted here:
https://drupal.org/node/2033161

work77’s picture

Hi thanks. The reason I want to use privatemsg_message_load() is because I'll be displaying the actual message on my own custom page. The url will contain the message ID, which I was hoping I could simply pass to some function (like privatemsg_message_load()) that would return all of the message info INCLUDING who the intended recipient is. So I could match that up with the current user to determine if she's allowed to view that message.

I notice in the link you provided in the following comment that privatemsg_message_load() is supposed to return false if the user isn't allowed to see it. That kinda would help me, but I was looking for the flexibility to make that decision myself with just getting back all the message info, including the recipient id. Is there another function that can accomplish this?

Berdir’s picture

the intended recipient

There is no such thing as *the* recipient. Each message can have any number of recipients, there are different types of recipients.

Privatemsg usually only displays and cares about recipients/participants of a message thread, there is AFAIK no API to get the recipients of a single message.

work77’s picture

Privatemsg usually only displays and cares about recipients/participants of a message thread

That's what I was referring to by "recipient." privatemsg_message_load() contains everything except WHO can read it, unfortunately. It would be convenient to hook into that info from my module, so I can do with it what I please.

ivnish’s picture

Issue summary: View changes
Status: Active » Closed (outdated)