phpbb\user_loader::get_rank PHP Method

get_rank() public method

Get rank
public get_rank ( integer $user_id, boolean $query = false ) : array
$user_id integer User ID of the user you want to retreive the rank for
$query boolean Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users()
return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'
    public function get_rank($user_id, $query = false)
    {
        if (!($user = $this->get_user($user_id, $query))) {
            return '';
        }
        if (!function_exists('phpbb_get_user_rank')) {
            include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
        }
        $rank = array('rank_title', 'rank_img', 'rank_img_src');
        $user_rank_data = phpbb_get_user_rank($user, $user['user_id'] == ANONYMOUS ? false : $user['user_posts']);
        $rank['rank_title'] = $user_rank_data['title'];
        $rank['rank_img'] = $user_rank_data['img'];
        $rank['rank_img_src'] = $user_rank_data['img_src'];
        return $rank;
    }