Skip to content

Commit

Permalink
#3874: SQL Error when sorting by username in online.php (#3881)
Browse files Browse the repository at this point in the history
* Use s.username rather than u.username

* Only use s.username for newer DB engines, use a str_replace() to change it from u.username in that case
  • Loading branch information
euantorano authored and dvz committed Jan 23, 2020
1 parent b00db13 commit 35a9edf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion online.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{
$mybb->settings['threadsperpage'] = 20;
}

// Add pagination
$perpage = $mybb->settings['threadsperpage'];

Expand Down Expand Up @@ -208,6 +208,8 @@
($db->type == 'sqlite' && version_compare($dbversion, '3.25.0', '>='))
)
{
$sql = str_replace('u.username', 's.username', $sql);

$query = $db->query("
SELECT * FROM (
SELECT
Expand Down

0 comments on commit 35a9edf

Please sign in to comment.