Filter a Drupal View result by matching a view field to a URL term

160 Views Asked by At

I have a content type called "Post" which contains two fields:

1) title 2) username

I created a View which creates a block that gathers all Posts. The block will reside on a user's account page, wherein the URL will always be: www.mysite.com/user/username

How can I filter that block to only show the results where the username field matches the second term in the URL?

Thanks!

1

There are 1 best solutions below

0
On

Use contextual filter in views and set raw value as second argument from the url (here second argument will be username).

Answered by @manikandankannan at https://drupal.stackexchange.com/questions/187686/filter-a-view-result-by-matching-a-view-field-to-a-url-term Thanks!