mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/13713] Implement ranks
PHPBB3-13713
This commit is contained in:
@@ -21,11 +21,11 @@ class friend extends user
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user)
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
parent::__construct($db, $user_loader);
|
||||
parent::__construct($db, $user_loader, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,13 +21,26 @@ abstract class group implements source_interface
|
||||
/** @var \phpbb\group\helper */
|
||||
protected $helper;
|
||||
|
||||
/** @var string */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var string */
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper)
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->helper = $helper;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if (!function_exists('phpbb_get_user_rank'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +106,7 @@ abstract class group implements source_interface
|
||||
$names = [];
|
||||
foreach ($group_ids as $group_id)
|
||||
{
|
||||
$group_rank = phpbb_get_user_rank($groups[$group_id], false);
|
||||
$names['g' . $group_id] = [
|
||||
'name' => $groups[$group_id]['group_name'],
|
||||
'param' => 'group_id',
|
||||
@@ -101,6 +115,7 @@ abstract class group implements source_interface
|
||||
'type' => 'group',
|
||||
'src' => phpbb_get_group_avatar($groups[$group_id]),
|
||||
],
|
||||
'rank' => $group_rank['title'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -21,13 +21,26 @@ abstract class user implements source_interface
|
||||
/** @var \phpbb\user_loader */
|
||||
protected $user_loader;
|
||||
|
||||
/** @var string */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var string */
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader)
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->user_loader = $user_loader;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
|
||||
if (!function_exists('phpbb_get_user_rank'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +63,7 @@ abstract class user implements source_interface
|
||||
$names = [];
|
||||
while ($row = $this->db->sql_fetchrow($res))
|
||||
{
|
||||
$user_rank = $this->user_loader->get_rank($row['user_id'], true);
|
||||
$names['u' . $row['user_id']] = [
|
||||
'name' => $row['username'],
|
||||
'param' => 'user_id',
|
||||
@@ -58,6 +72,7 @@ abstract class user implements source_interface
|
||||
'type' => 'user',
|
||||
'src' => $this->user_loader->get_avatar($row['user_id'], true),
|
||||
],
|
||||
'rank' => (isset($user_rank['rank_title'])) ? $user_rank['rank_title'] : '',
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -21,11 +21,11 @@ class usergroup extends group
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user)
|
||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\group\helper $helper, \phpbb\user $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
parent::__construct($db, $helper);
|
||||
parent::__construct($db, $helper, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user