ok. Here we go:
find in private.php this line:
Code:
if ($what=="delete") {
then substitute the whole block till // end while
with this code.
Code:
if ($what=="delete") {
if (is_array($privatemessage)) {
while(list($key,$val)=each($privatemessage)) {
// for every pm get the attachmentid first !
$ata = array(); $atas = array();
echo "SELECT attachmentid FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid] LIMIT 1";
$ata = $DB_site->query_first("SELECT attachmentid FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
// then look if there are more than one
if ($ata[0] != '') {
$ataid = $ata[0];
// Count if there are more than one !
$atas = $DB_site->query_first("SELECT COUNT(*) FROM privatemessage WHERE attachmentid = $ataid");
echo "<br>SELECT COUNT(*) FROM attachment WHERE attachmentid = $ataid";
// If there is only 1, delete it !
if ($atas[0] == '1') {
$atasid = $atas[0];
echo"<br>$atas[0]<br>DELETE FROM attachment WHERE attachmentid = $ataid";
$DB_site->query("DELETE FROM attachment WHERE attachmentid = $ataid");
} // else make error message !
}
// $DB_site->query("DELETE FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
} //end while
Im no programer at all, maybe something to improve ?