[feature/avatars] Pass phpbb_user object to get_custom_html()

Pass the phpbb_user object to function get_custom_html(). This object is
used in that method. Also fixed incorrect arguments to get_custom_html()
in phpbb_get_avatar().

PHPBB3-10018
This commit is contained in:
Marc Alexander 2013-01-08 15:34:20 +01:00
parent 023d7a972d
commit 8778c9c945
4 changed files with 7 additions and 4 deletions

View file

@ -71,7 +71,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function get_custom_html($row, $alt = '') public function get_custom_html($user, $row, $alt = '')
{ {
return ''; return '';
} }

View file

@ -41,7 +41,7 @@ class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function get_custom_html($row, $alt = '') public function get_custom_html($user, $row, $alt = '')
{ {
return '<img src="' . $this->get_gravatar_url($row) . '" ' . return '<img src="' . $this->get_gravatar_url($row) . '" ' .
($row['avatar_width'] ? ('width="' . $row['avatar_width'] . '" ') : '') . ($row['avatar_width'] ? ('width="' . $row['avatar_width'] . '" ') : '') .

View file

@ -41,11 +41,14 @@ interface phpbb_avatar_driver_interface
/** /**
* Returns custom html if it is needed for displaying this avatar * Returns custom html if it is needed for displaying this avatar
* *
* @param phpbb_user $user phpBB user object
* @param array $row User data or group data that has been cleaned with
* phpbb_avatar_manager::clean_row
* @param string $alt Alternate text for avatar image * @param string $alt Alternate text for avatar image
* *
* @return string HTML * @return string HTML
*/ */
public function get_custom_html($row, $alt = ''); public function get_custom_html($user, $row, $alt = '');
/** /**
* Prepare form for changing the settings of this avatar * Prepare form for changing the settings of this avatar

View file

@ -1400,7 +1400,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false)
if ($driver) if ($driver)
{ {
$html = $driver->get_custom_html($row, $ignore_config, $alt); $html = $driver->get_custom_html($user, $row, $alt);
if (!empty($html)) if (!empty($html))
{ {
return $html; return $html;