1

Does anyone know how to display every article (or content type) a user has published on their "my account" view? To clarify, I only want it to display that specific user's published content so that all users can click on a user and then see all of that particular user's published content.

What I currently have set up so far is my account/user's view page setup and displays the user's username and ALL published content. Still, it isn't filtered by the specific user's account/ content, only if the content is published or not.

I've tried adding different filters, but none have worked for me. I've also tried adding a "username of the content author" relationship, but that still won't do the trick. If it's helpful, the view's URL is /user/* (* representing a different number depending on which user's account view you are on)

Update: I installed pathauto module and changed the view's URLs to /user/[username] (so if your username is "human," the URL is now /user/human)

4
  • 4
    I'm somewhat in a hurry. "Advanced / Contextual Filters", then choosing the Author/User ID field should do it. It will automatically use the User ID from URL contextual filter. Nov 27, 2022 at 13:38
  • @MarioSteinitz thank you for the reply, there were a few different variations of this filter and I tried them all but it’s still not working properly Nov 29, 2022 at 13:05
  • @ImagineSystem7 first we need to know what content your view is of. When you created the view in /admin/structure/views/add did you select "show: content" or "show: users"?
    – No Sssweat
    Dec 10, 2022 at 5:49
  • 1
    The trick is to configure the contextual filter (of the author ID) to Provide default value and set that to User ID from route context. You can search this site with these terms to find a more detailed example with more steps.
    – prkos
    Dec 31, 2022 at 1:23

1 Answer 1

1

You are creating a view. Since you want it on the entity.user.canonical route, you need to create a block.

The view needs a contextual filter to use the user id from the URL path as a filter.

Next to Contextual filters click Add. Select 'Content: Authored By'. In When the filter is NOT in the URL select 'Provide default value'. Set Type to 'User Id from route context'

add a contextual filter to a view

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .