1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/15233] Standardize avatar output variables

PHPBB3-15233
This commit is contained in:
mrgoldy
2019-12-16 20:23:45 +01:00
committed by Marc Alexander
parent 3137070d50
commit 7e3d22063a
16 changed files with 182 additions and 50 deletions

View File

@@ -3523,6 +3523,8 @@ function phpbb_quoteattr($data, $entities = null)
/**
* Get user avatar
*
* @deprecated 4.0.0 Use \phpbb\avatar\helper::get_user_avatar() instead
*
* @param array $user_row Row from the users table
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
@@ -3539,6 +3541,8 @@ function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config =
/**
* Get group avatar
*
* @deprecated 4.0.0 Use \phpbb\avatar\helper::get_group_avatar() instead
*
* @param array $group_row Row from the groups table
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
@@ -3555,6 +3559,8 @@ function phpbb_get_group_avatar($group_row, $alt = 'GROUP_AVATAR', $ignore_confi
/**
* Get avatar
*
* @deprecated 4.0.0 Use \phpbb\avatar\helper::get_avatar() instead
*
* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
@@ -3862,6 +3868,11 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
// Add form token for login box, in case page is presenting a login form.
add_form_key('login', '_LOGIN');
/** @var \phpbb\avatar\helper $avatar_helper */
$avatar_helper = $phpbb_container->get('avatar.helper');
$avatar = $avatar_helper->get_user_avatar($user->data);
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
@@ -3876,7 +3887,13 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'RECORD_USERS' => $l_online_record,
'PRIVATE_MESSAGE_COUNT' => (!empty($user->data['user_unread_privmsg'])) ? $user->data['user_unread_privmsg'] : 0,
'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data),
'CURRENT_USER_AVATAR' => $avatar['html'],
'CURRENT_USER_AVATAR_LAZY' => $avatar['lazy'],
'CURRENT_USER_AVATAR_SOURCE' => $avatar['src'],
'CURRENT_USER_AVATAR_TITLE' => $avatar['title'],
'CURRENT_USER_AVATAR_TYPE' => $avatar['type'],
'CURRENT_USER_AVATAR_WIDTH' => $avatar['width'],
'CURRENT_USER_AVATAR_HEIGHT' => $avatar['height'],
'CURRENT_USERNAME_SIMPLE' => get_username_string('no_profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
'CURRENT_USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
'CURRENT_USER_GROUP_COLOR' => $user->data['user_colour'],