One Soft Decoder member wanted to allow site admins to show the content created by different users.
For example, the admins wanted to see all the articles written by a particular user, or all the orders they made in the store.
I'm going to make this happen by creating a search page using Views.
First, make sure that users are associated with your content, as in the example below:
- Go to Structure > Views > Create new view.
- Choose to Show "Content".
- The other settings you can choose according to your needs.
- Under the "Advanced" tab on the right-hand side, click "Add" next to "Relationships":
- Search for and choose the "Content: Author" relationship.
- Click "Apply (All displays)" twice to save the relationship.
- On the left-hand side, under Filter Criteria, click "Add".
- Search for and choose "User: Name (raw)".
- Click "Apply (All displays)".
- Check the box, "Expose this filter to visitors, to allow them to change it".
- Click "Apply (All displays)".
- Save your view.
- Visit the view on the front of your site, and you should be able to search for users' content, using the exposed filter:
Pro tip: inside the View, set "Use Ajax" to "Yes" under the "Advanced" tab on the right-hand side. This will allow the search to load without refreshing the whole page.