MyBB Community Forums

Full Version: [F] Delete a PM using the delete button [C-Chris W B.]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you open a PM in the trash folder and click on the delete button the message remains in the trash folder.

Possible fix: In private.php find:
$sql_array = array(
	"folder" => 4,
	"deletetime" => TIME_NOW
);
$db->update_query("privatemessages", $sql_array, "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'");
Replace with:
$query = $db->simple_select("privatemessages", "*", "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."' AND folder='4'", array('order_by' => 'pmid'));
if($db->num_rows($query) == 1)
{
	$db->delete_query("privatemessages", "pmid='".intval($mybb->input['pmid'])."'");
}
else
{
	$sql_array = array(
		"folder" => 4,
		"deletetime" => TIME_NOW
	);
	$db->update_query("privatemessages", $sql_array, "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'");
}
$db->num_rows ?
I'm sure he wanted to write

$db->num_rows($query)

He wrote that at 3:02 AM so it's understandable that mistakes occur ;D
Sorry, I updated the code in my last post. Wink
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group