diff --git a/phpBB/config/default/container/services_mention.yml b/phpBB/config/default/container/services_mention.yml index 286c16a8da..8b466b3b01 100644 --- a/phpBB/config/default/container/services_mention.yml +++ b/phpBB/config/default/container/services_mention.yml @@ -27,6 +27,26 @@ services: tags: - { name: mention.source } + phpbb.mention.source.member: + class: phpbb\mention\source\member + arguments: + - '@dbal.conn' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: mention.source } + + phpbb.mention.source.team: + class: phpbb\mention\source\team + arguments: + - '@dbal.conn' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: mention.source } + phpbb.mention.source.topic: class: phpbb\mention\source\topic arguments: diff --git a/phpBB/phpbb/mention/source/member.php b/phpBB/phpbb/mention/source/member.php new file mode 100644 index 0000000000..bc1c5960ee --- /dev/null +++ b/phpBB/phpbb/mention/source/member.php @@ -0,0 +1,35 @@ + + * @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 member extends user +{ + /** + * {@inheritdoc} + */ + protected function query($keyword, $topic_id) + { + $query = $this->db->sql_build_query('SELECT', [ + 'SELECT' => 'u.username, u.user_id', + 'FROM' => [ + USERS_TABLE => 'u', + ], + 'WHERE' => 'u.user_id <> ' . ANONYMOUS . ' + AND ' . $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]) . ' + AND u.username_clean ' . $this->db->sql_like_expression($keyword . $this->db->get_any_char()), + 'ORDER_BY' => 'u.user_lastvisit DESC' + ]); + return $query; + } +} diff --git a/phpBB/phpbb/mention/source/team.php b/phpBB/phpbb/mention/source/team.php new file mode 100644 index 0000000000..dce5630944 --- /dev/null +++ b/phpBB/phpbb/mention/source/team.php @@ -0,0 +1,38 @@ + + * @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 team extends user +{ + /** + * {@inheritdoc} + */ + protected function query($keyword, $topic_id) + { + $query = $this->db->sql_build_query('SELECT', [ + 'SELECT' => 'u.username, u.user_id', + 'FROM' => [ + USERS_TABLE => 'u', + USER_GROUP_TABLE => 'ug', + TEAMPAGE_TABLE => 't', + ], + 'WHERE' => 'ug.group_id = t.group_id AND ug.user_id = u.user_id AND ug.user_pending = 0 + AND u.user_id <> ' . ANONYMOUS . ' + AND ' . $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]) . ' + AND u.username_clean ' . $this->db->sql_like_expression($keyword . $this->db->get_any_char()), + 'ORDER_BY' => 'u.user_lastvisit DESC' + ]); + return $query; + } +}