diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-07-30 17:01:35 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-01 10:18:57 +0200 |
commit | 39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47 (patch) | |
tree | 57f58ba2fc9793244636d1ede3ffc2ee99981782 | |
parent | 4f13b049f813916e6393c8c4cc0227d3f52c2318 (diff) | |
download | forums-39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47.tar forums-39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47.tar.gz forums-39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47.tar.bz2 forums-39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47.tar.xz forums-39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47.zip |
[feature/php-events] Allow core.user_get_avatar to overwrite all avatars
PHPBB3-9550
-rw-r--r-- | phpBB/includes/functions_display.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1e093e6811..bf379a40f4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1327,17 +1327,33 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ global $user, $config, $phpbb_root_path, $phpEx; global $phpbb_dispatcher; + $overwrite_avatar = ''; + + /** + * Overwrite users avatar + * + * @event core.display_custom_bbcodes_modify_row + * @var string avatar Users assigned avatar name + * @var int avatar_type Type of avatar + * @var string avatar_width Width of users avatar + * @var string avatar_height Height of users avatar + * @var string alt Language string for alt tag within image + * Can be a language key or text + * @var bool ignore_config Ignores config and force displaying avatar + * @var string overwrite_avatar If set, this string will be the avatar + * @since 3.1-A1 + */ + $vars = array('avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'alt', 'ignore_config', 'overwrite_avatar'); + extract($phpbb_dispatcher->trigger_event('core.user_get_avatar', compact($vars))); + + if ($overwrite_avatar) + { + return $overwrite_avatar; + } + if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) { - $default_avatar = ''; - if ($config['allow_avatar'] || $ignore_config) - { - // This allows extensions to change the default return when no avatar is given - // Useful for default avatars - $vars = array('avatar', 'avatar_type', 'ignore_config', 'default_avatar'); - extract($phpbb_dispatcher->trigger_event('core.get_user_avatar_default', compact($vars))); - } - return $default_avatar; + return ''; } $avatar_img = ''; |