0

I'm working on a Drupal 8 site. I made a custom page view displaying special content created by the user. The menu tab shows on the user profile correctly by using Pathauto to show the correct address on the primary user profile page using a pattern of: user/[user:field_full_name].

On the tab page created by my custom view, I can't get it to show the user name, only the user ID from the page view path: /user/%user/other-work

I would like the tab's page view URL to show the user's name instead of just the user ID. I already tried different patterns in Pathauto, but it doesn't seem to have that ability. Pathauto does work for fixing the default user page URL, but none of my custom views pages I added. Does anyone know if it's possible for a custom view page like mine to show the user's name instead of the UID in the tab's URL?

0

To replace UID in view tab with name on user profile page:

follow those steps:

  1. Create a user relationship : enter image description here
  2. Add contextual filters with User Name enter image description here 3.Configure your contextual filter ((author) User: Name) like this enter image description here
  3. Save your configuration.

Result enter image description here

6
  • Thanks, but that didn't work either. The only path it will let me use is /user/%user/other-work and that continues to only show the user ID number. – TomP Dec 13 '20 at 14:46
  • I have tested it on Drupal 8.9 and also 9.1.0 it works for me – berramou Dec 17 '20 at 16:45
  • Did you change the path from /user/%user/? I'm doing something wrong but I just can't find it. I made a test view doing the exact steps you showed and the URL still shows the UID number. – TomP Dec 19 '20 at 18:34
  • When you configure your view go to /user/admin/other-work for example instead of /user/1/other-work you should see the articles created by admin – berramou Dec 19 '20 at 20:33
  • Okay @berramou now I see where we're crossing wires. This view is generating a menu tab that shows on the users profiles pages. The URL of the menu tab is /user/%user/other-work. Here is where I'm trying to get it to show with the user's name in the URL. I see that if I manually type the user's name in the URL like: www.mysite.com/user/test-writer/other-work it does show the page. – TomP Dec 19 '20 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.