Skip to content

Commit

Permalink
When a comment author is deleted, show 'Account Deleted' as author name.
Browse files Browse the repository at this point in the history
See #3340.
  • Loading branch information
boonebgorges committed Jul 9, 2024
1 parent a4543e2 commit 9bddde5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions wp-content/plugins/wds-citytech/wds-citytech.php
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,27 @@ function( $ip ) {
}
);

/**
* Show 'Account Deleted' for the user name of deleted comment authors.
*
* @param string $author The comment author.
* @param int $comment_ID The comment ID.
* @param WP_Comment $comment The comment object.
* @return string
*/
function openlab_deleted_comment_author_name( $author, $comment_ID, $comment ) {
if ( ! $comment || ! $comment->user_id ) {
return $author;
}

$user = get_userdata( $comment->user_id );
if ( $user && ! $user->deleted ) {
return $author;
}

return 'Account Deleted';
}

/**
* Adds the URL of the user profile to the New User Registration admin emails
*
Expand Down

0 comments on commit 9bddde5

Please sign in to comment.