From 8936cf014bb95220bc2409ba17b10e2db6f80f1c Mon Sep 17 00:00:00 2001
From: Matthew Slater <matslats@fastmail.com>
Date: Mon, 1 Aug 2022 13:45:15 +0200
Subject: [PATCH] clarified that isnew users are not anon

---
 alt_login.module | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/alt_login.module b/alt_login.module
index ceaca7c..1b43730 100644
--- a/alt_login.module
+++ b/alt_login.module
@@ -26,7 +26,7 @@ function alt_login_help($route_name, $route_match) {
  * @note there's no easy way to dedupe accounts' display names.
  */
 function alt_login_user_format_name_alter(&$name, AccountInterface $account) {
-  if ($account->isAnonymous()) { // includes accounts tha
+  if ($account->isAnonymous() and !$account->isNew()) { // includes accounts tha
     // This will be the configured 'anonymous' value
     return;
   }
@@ -34,7 +34,7 @@ function alt_login_user_format_name_alter(&$name, AccountInterface $account) {
   $uid = $account->id();
   if (!isset($names[$uid])) {
     // Anonymous users
-    if (\Drupal::currentUser()->isAnonymous() and !$account->isNew()) {
+    if (\Drupal::currentUser()->isAnonymous()) {
       $anon = \Drupal::config('alt_login.settings')->get('display_anon');
       $names[$uid] = \Drupal::token()
         ->replace($anon, ['user' => $account], ['clear' => true]);
-- 
GitLab