I am formatting the user profile page in Drupal 8.9.2.
Are tokens available for the user being viewed (in user profile page), to display the user information?
I am using the Token and the Token Filter modules for this. (edited: 8:44 AM 10 Sep 20)
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
I have solved the problem this way.
(1) I created a View to show desired user information.
(2) Then, I added a 'Contextual filter' to point to the user being viewed. (with the options "User ID > Provide default value > Type: User ID from route context")
(3) Then, I selected 'REWRITE RESULTS' and "Override the output of this field with custom text". As a result replacement tokens become available for user fields. I used that for formatting the Information according to the requirement.
Then, I placed this View block at the desired place.