Skip to content

Commit 1fd6247

Browse files
committed
SUPP0RT-662: Fixed issue with non-existing user
1 parent 46663fc commit 1fd6247

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web/profiles/custom/os2loop/themes/os2loop_theme/templates/field/user-info.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
*/
1010
#}
1111

12-
{# Display author if not anonymous #}
13-
{% set is_anonymous_user = 1 == entity.os2loop_content_anonymous_author.value %}
12+
{# Check if author is anonymous or not set (e.g. due to missing user) #}
13+
{% set is_anonymous_user = user['#user'] is empty or 1 == entity.os2loop_content_anonymous_author.value %}
1414
{% set image = not is_anonymous_user ? drupal_field('os2loop_user_image', 'user', user['#user'].id, 'compact') %}
1515
{% set initials = (is_anonymous_user ? 'Anonymous user'|t|first : (user['#user'].os2loop_user_given_name.value|first ~ user['#user'].os2loop_user_family_name.value|first))|upper %}
1616

0 commit comments

Comments
 (0)