Score:1

How to display 'Welcome [first_name] [last_name]' in a custom views block? D8

ae flag

I would like to create a custom block / view to display a welcome message to the currently logged in user in Drupal 8. I followed this answer but it isn't working for me. Maybe things changed in D8. Is there a way to do it in D8 and / or am I doing something wrong?

I've added a bunch of Fields and Contextual Filters trying to get it to work but nothing shows up.

enter image description here

Score:1
in flag

Changes:

  1. Remove all the contextual filters, that you added. They are not necessary. You have already a filter criteria for the current user.
  2. Change format from table to an unformatted list.
  3. Remove all the fields except first name, last name.
  4. Click on first name and exclude it from display.
  5. Click on last name. Find the fieldset to override results, expand it.
  6. Write your message there. It should look like: Welcome {{field_first_name}} {{field_last_name}}. You can look up the exact tokens in a fieldset below the text field.
  7. Save the views.
  8. Place your block in some region at /admin/structure/block.
jbreslow avatar
ae flag
Thank you! That worked perfectly. Much appreciated.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.