1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-26 01:04:10 +02:00
2021-05-14 21:52:01 +02:00

46 lines
1.1 KiB
PHP

<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\mention\source;
class topic extends base_user
{
/**
* {@inheritdoc}
*/
protected function query($keyword, $topic_id)
{
/*
* For optimization purposes all users are returned regardless of the keyword
* Names filtering is done on the frontend
* Results will be cached on a per-topic basis
*/
$query = $this->db->sql_build_query('SELECT', [
'SELECT' => 'u.username, u.user_id',
'FROM' => [
USERS_TABLE => 'u',
],
'LEFT_JOIN' => [
[
'FROM' => [POSTS_TABLE => 'p'],
'ON' => 'u.user_id = p.poster_id'
]
],
'WHERE' => 'p.topic_id = ' . $topic_id . '
AND ' . $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]),
'ORDER_BY' => 'p.post_time DESC'
]);
return $query;
}
}