In my recent update to HEAD, I replaced the old phpbb2 based query:

$query = "SELECT p.privmsgs_id, p.privmsgs_from_userid, p.privmsgs_to_userid,
p.privmsgs_subject, pt.privmsgs_text, pt.privmsgs_bbcode_uid, p.privmsgs_date,
               CASE WHEN p.privmsgs_type = 1 THEN 1
               WHEN p.privmsgs_type = 5 THEN 1
               ELSE 0 	 
	       END as newmsg, 	 
	       p.privmsgs_ip, 0, 0, 0 	 
	       FROM %sprivmsgs p 	 
	       LEFT JOIN %sprivmsgs_text AS pt ON p.privmsgs_id = pt.privmsgs_text_id"; 	 
	   $messages = db_query($query, $pre, $pre);

with a new one:

<?php
$query = "SELECT * FROM %sprivmsgs";
?>

currently, this is enough. but once the privatemsg for drupal supports it, ideally there should be a JOIN with the privmsgs_to table to get the new or unread status. That kind of query is beyond my skills (anythign beyond the most basic of sql = greek to me.)

Comments

naheemsays’s picture

Status: Active » Closed (duplicate)