MyBB Community Forums

Full Version: [F] Printthread doesn't show unapproved posts [C-Michael83]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi developers,

xeniun (MyBBoard.it) found this bug, printthread.php doesn't show unapproved posts also if you have enough permissions.

This is also easily fixable. Smile

Find:
$query = $db->query("
	SELECT u.*, u.username AS userusername, p.*
	FROM ".TABLE_PREFIX."posts p
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
	WHERE p.tid='$tid' AND p.visible=1
	ORDER BY p.dateline
");

Replace with:
if(is_moderator($fid))
{
	$visible = "AND (p.visible='0' OR p.visible='1')";
}
else
{
	$visible = "AND p.visible='1'";
}
$query = $db->query("
	SELECT u.*, u.username AS userusername, p.*
	FROM ".TABLE_PREFIX."posts p
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
	WHERE p.tid='$tid' {$visible}
	ORDER BY p.dateline
");
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