3

I'm trying to make page with nodes filtered by author name. My context filter is comming from url.

My path looks like domain.xx/drupal/authors/johny

If i set validation by user ID, and send user ID in path, all works properly.

You can see contextual filter setup in attachment.


enter image description here

1
  • 1
    Be aware that exposing a user name is a possible security exploit (half of the username and password combination is already confirmed). Some people assume usernames to be public, other prefer to keep them hidden for regular users. You can search for 'username enumeration prevention'. May 8 '17 at 13:42
1

On editing view, click the advanced settings then click relationships area, click Add.

There are many tables you can join to the content listing. In this case, search for "author" options, and select Content: Content author. Click Apply. Now add field 'user' in view also set filter criteria as needed.

enter image description here

enter image description here

0

Depending on your configuration (if domain.xx/drupal/authors/johny is the path alias of a user account), you can also select user id from url as the default value, instead of raw value from URL.

Drupal will recognize the unaliased path user/x and extract the user id.

For this to work, your contextual filter must filter by auther id.

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.