Skip to content

Commit

Permalink
Don't show avatar when it's off
Browse files Browse the repository at this point in the history
If avatar is off or user doesn't have access to see it
then don't show an avatar image.

Fixes #20641
  • Loading branch information
vboctor authored and dregad committed Mar 19, 2016
1 parent 4b66b54 commit a05fca6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/classes/Avatar.class.php
Expand Up @@ -65,15 +65,15 @@ public static function get( $p_user_id, $p_size = 80 ) {
$t_avatar = event_signal(
'EVENT_USER_AVATAR',
array( $p_user_id, $p_size ) );
}

if( $t_avatar === null ) {
$t_avatar = new Avatar();
}
if( $t_avatar === null ) {
$t_avatar = new Avatar();
}

$t_avatar->normalize( $p_user_id );
$t_avatar->normalize( $p_user_id );
}

return $t_avatar;
return $t_avatar;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions core/classes/TimelineEvent.class.php
Expand Up @@ -73,6 +73,10 @@ public function format_timestamp( $p_timestamp ) {
*/
public function html_start() {
$t_avatar = Avatar::get( $this->user_id, 32 );
if( $t_avatar === null ) {
return sprintf(
'<div class="entry"><div class="timestamp">%s</div>', $this->format_timestamp( $this->timestamp ) );
}

return sprintf(
'<div class="entry"><div class="avatar"><a href="%s"><img class="avatar" src="%s" alt="%s" width="32" height="32" /></a></div><div class="timestamp">%s</div>',
Expand Down
3 changes: 3 additions & 0 deletions core/print_api.php
Expand Up @@ -187,6 +187,9 @@ function print_successful_redirect( $p_redirect_to ) {
*/
function print_avatar( $p_user_id, $p_size = 80 ) {
$t_avatar = Avatar::get( $p_user_id, $p_size );
if( $t_avatar === null ) {
return;
}

$t_image = htmlspecialchars( $t_avatar->image );
$t_link = htmlspecialchars( $t_avatar->link );
Expand Down

0 comments on commit a05fca6

Please sign in to comment.