get_value('user_info_'.$UserID)) === FALSE) { $DB->query("SELECT m.Username, m.Enabled, m.Title, i.Avatar, i.Donor, i.Warned FROM users_main AS m JOIN users_info AS i ON i.UserID = m.ID WHERE m.ID = $UserID"); if($DB->record_count() == 0){ // If user doesn't exist error(404); } list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record(); } else { extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); } if(check_perms('site_proxy_images') && !empty($Avatar)) { $Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Avatar); } show_header('Post history for '.$Username,'subscriptions,comments,bbcode'); if($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); } $ViewingOwn = ($UserID == $LoggedUser['ID']); $ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread'])); $ShowGrouped = ($ViewingOwn && (!isset($_GET['group']) || !!$_GET['group'])); if($ShowGrouped) { $sql = 'SELECT SQL_CALC_FOUND_ROWS MAX(p.ID) AS ID FROM forums_posts AS p LEFT JOIN forums_topics AS t ON t.ID = p.TopicID'; if($ShowUnread) { $sql.=' LEFT JOIN forums_last_read_topics AS l ON l.TopicID = t.ID AND l.UserID = '.$LoggedUser['ID']; } $sql .= ' LEFT JOIN forums AS f ON f.ID = t.ForumID WHERE p.AuthorID = '.$UserID.' AND f.MinClassRead <= '.$LoggedUser['Class']; if(!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; } if($ShowUnread) { $sql .= ' AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostIDquery($sql); $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); if($Results > $PerPage*($Page-1)) { $DB->set_query_id($PostIDs); $PostIDs = $DB->collect('ID'); $sql = 'SELECT p.ID, p.AddedTime, p.Body, p.EditedUserID, p.EditedTime, ed.Username, p.TopicID, t.Title, t.LastPostID, l.PostID AS LastRead, t.IsLocked, t.IsSticky FROM forums_posts as p LEFT JOIN users_main AS um ON um.ID = p.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID JOIN forums_topics AS t ON t.ID = p.TopicID JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID WHERE p.ID IN ('.implode(',',$PostIDs).') ORDER BY p.ID DESC'; $Posts = $DB->query($sql); } } else { $sql = 'SELECT SQL_CALC_FOUND_ROWS'; if($ShowGrouped) { $sql.=' * FROM (SELECT'; } $sql .= ' p.ID, p.AddedTime, p.Body, p.EditedUserID, p.EditedTime, ed.Username, p.TopicID, t.Title, t.LastPostID,'; if($UserID == $LoggedUser['ID']) { $sql .= ' l.PostID AS LastRead,'; } $sql .= ' t.IsLocked, t.IsSticky FROM forums_posts as p LEFT JOIN users_main AS um ON um.ID = p.AuthorID LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID JOIN forums_topics AS t ON t.ID = p.TopicID JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID WHERE p.AuthorID = '.$UserID.' AND f.MinClassRead <= '.$LoggedUser['Class']; if(!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; } if($ShowUnread) { $sql.=' AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostIDquery($sql); $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); $DB->set_query_id($Posts); } ?>

$Username"; } elseif($ShowUnread) { echo "Unread post history for $Username"; } else { echo "Post history for $Username"; } ?>

No topics
next_record()){ ?> ' id='post'>
in (New!) [Subscribe]  
<?=$Username?>'s avatar
full_format($Body)?>

« Last edited by