Skip to content

Commit eca84b5

Browse files
committed
Fix emoji display in wp-admin
1 parent 1c9c247 commit eca84b5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

assets/css/activitypub-admin.css

+4
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,7 @@ input.blog-user-identifier {
223223
.like .dashboard-comment-wrap .comment-author {
224224
margin-block: 0;
225225
}
226+
227+
.edit-comments-php .column-author img.emoji {
228+
float: none;
229+
}

includes/class-comment.php

+15
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static function init() {
3131
\add_filter( 'pre_comment_approved', array( static::class, 'pre_comment_approved' ), 10, 2 );
3232
\add_filter( 'get_avatar_comment_types', array( static::class, 'get_avatar_comment_types' ), 99 );
3333
\add_filter( 'pre_wp_update_comment_count_now', array( static::class, 'pre_wp_update_comment_count_now' ), 10, 3 );
34+
\add_filter( 'comment_author', array( static::class, 'allow_emoji' ) );
3435
}
3536

3637
/**
@@ -795,4 +796,18 @@ public static function pre_wp_update_comment_count_now( $new_count, $old_count,
795796

796797
return $new_count;
797798
}
799+
800+
/**
801+
* Allow emoji in comment author name.
802+
*
803+
* @param string $author The comment author name.
804+
* @return string The comment author name with rendered emoji.
805+
*/
806+
public static function allow_emoji( $author ) {
807+
if ( false !== strpos( $author, 'emoji' ) ) {
808+
$author = str_replace( '', '"', \html_entity_decode( $author ) );
809+
}
810+
811+
return $author;
812+
}
798813
}

0 commit comments

Comments
 (0)