Simply, you do 2 joins, on the same table, but matching the 2 users.
How do I select username twice
SELECT phpbb_privmsgs_text.privmsgs_text, user_from.username as from, user_to.username as to
INNER JOIN phpbb_privmsgs
ON phpbb_privmsgs.privmsgs_id = phpbb_privmsgs_text.privmsgs_text_id
INNER JOIN phpbb_users as user_from
ON phpbb_users.user_id = phpbb_privmsgs.privmsgs_from_userid
INNER JOIN phpbb_users as user_to
ON phpbb_users.user_id = phpbb_privmsgs.privmsgs_to_userid
I would be you, I'll bail out. As you said, private is private.
I will not do this unless it is disclosed to th members but members are 60+ and may not understand this and the owner knows this.
I may be a bit overzealous, but as long as there is no a requirement from the justice, I would refuse to do that.
More on the point, in my country, you are not allowed to eye drop on a private conversation.
If the users notice this, they can bring the operator to a court and trial him, as well as the people that helped him to achieve this.
It goes even as far as the boss of a firm is not allowed to inspect the mails that come from or are going to his employees, except if the employees are noticed of this.
An email is considered as private as a letter, and protected the same way.