MyBB Community Forums

Full Version: Bug: Recent threads on profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There are some problems with the recent threads in profile plugin. You get a sql error when there are unviewable forums.

I changed the queries a little bit so that the plugin is working correctly.

Search for:
	$unviewableforums = '';
	$unviewableforums = getunviewableforums();
	
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE uid='$uid' AND fid NOT IN ('$unviewableforums')");
Replace with:
	$unviewableforums = getunviewableforums(); 
        
    if($unviewableforums)
    {
    $unviewwhere = "AND fid NOT IN ($unviewableforums)";
    }
	
	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE uid='$uid' $unviewwhere");
Search for:
		$query = $db->query("SELECT t.*, f.name, i.path FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=t.fid) LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid=t.icon) WHERE t.uid='$uid' AND t.fid NOT IN ('$unviewableforums') ORDER BY t.dateline DESC LIMIT $settings[recentthreadsno]");
Replace with:
	    if($unviewableforums)
        {
        $unviewwhere = "AND t.fid NOT IN ($unviewableforums)";
        }
		$query = $db->query("SELECT t.*, f.name, i.path FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=t.fid) LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid=t.icon) WHERE t.uid='$uid' $unviewwhere ORDER BY t.dateline DESC LIMIT $settings[recentthreadsno]");
What to Edit:cry: ?? (The Plugin?)
Because i can't find:
$unviewableforums = '';
    $unviewableforums = getunviewableforums();
    
    $query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE uid='$uid' AND fid NOT IN ('$unviewableforums')");

Thank You!