Navigation Menu

Skip to content

Commit

Permalink
Don't display mentions with realname
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Apr 28, 2016
1 parent dbdc3ef commit 989db33
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions core/mention_api.php
Expand Up @@ -134,9 +134,16 @@ function mention_format_text( $p_text, $p_html = true ) {

$t_formatted_mentions = array();

foreach( $t_mentioned_users as $t_user_name => $t_user_id ) {
if( $t_username = user_get_name( $t_user_id ) ) {
$t_mention = '@' . user_get_field( $t_user_id, 'username' );
foreach( $t_mentioned_users as $t_username => $t_user_id ) {
if( user_exists( $t_user_id ) ) {
$t_mention = '@' . $t_username;

# Uncomment the line below to use realname / username based on settings
# The reason we always use username is to avoid confusing users by showing
# @ mentions using realname but only supporting it using usernames.
# We could support realnames if we assume they contain no spaces, but that
# is unlikely to be the case.
# $t_username = user_get_name( $t_user_id );

if( $p_html ) {
$t_username = string_display_line( $t_username );
Expand Down Expand Up @@ -189,8 +196,8 @@ function mention_format_text_save( $p_text, $p_mentioned_users = null ) {

$t_formatted_mentions = array();

foreach( $t_mentioned_users as $t_user_name => $t_user_id ) {
$t_formatted_mentions[$t_user_name] = "{U" . $t_user_id . "}";
foreach( $t_mentioned_users as $t_username => $t_user_id ) {
$t_formatted_mentions[$t_username] = "{U" . $t_user_id . "}";
}

$t_text = str_replace(
Expand Down Expand Up @@ -237,7 +244,8 @@ function mention_format_text_load( $p_text, $p_user_lookup = null ) {
$t_username = false;
}
} else {
$t_username = user_get_name( $t_user_id );
# Use username rather than name since we don't want to use realname.
$t_username = user_get_field( $t_user_id, 'username' );
}

if( $t_username ) {
Expand Down

0 comments on commit 989db33

Please sign in to comment.