mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/13713] Add two new sources: member and team
PHPBB3-13713
This commit is contained in:
parent
c70ac7eb62
commit
52c2e11fdd
3 changed files with 93 additions and 0 deletions
|
@ -27,6 +27,26 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: mention.source }
|
- { 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:
|
phpbb.mention.source.topic:
|
||||||
class: phpbb\mention\source\topic
|
class: phpbb\mention\source\topic
|
||||||
arguments:
|
arguments:
|
||||||
|
|
35
phpBB/phpbb/mention/source/member.php
Normal file
35
phpBB/phpbb/mention/source/member.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?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 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;
|
||||||
|
}
|
||||||
|
}
|
38
phpBB/phpbb/mention/source/team.php
Normal file
38
phpBB/phpbb/mention/source/team.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?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 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue