Skip Navigation

[Resolved] Create a View with posts where the current user is the author

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can we create a list of Posts where only Posts of the current user are shown?

Solution:
You can add a Query Filter that says:

Select posts with the author the same as the current logged in user.

When you edit the View, you open the Query Filter "Add Filter" GUI and choose "Post Author", then "Post author is the same as the logged in user"

This will query posts as created by the currently logged in user.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#618342

When adding a post relationship filter to a view. I would like the option to "show only posts created by the current user".
In frontend the user would only be able to filter on posts they created.

Example.
User role "Organizer" can create "Events".
User role "Exhibitor" can create a "Booking" for an "Event".
The Organizer visits a page with a table showing "Bookings". Above the table there is an option filter the "Bookings" on "Events". It should only be possible for the organizer to filter on the Events they created. Events created by other Organizers should not be visible in the filter.

The view should only show "Bookings" related to "Events" created by the Organizer on page load.

#618589

Just as in any other Post View, you can add a Query Filter that says:

Select posts with the author the same as the current logged in user.

When you edit the View, you open the Query Filter "Add Filter" GUI and choose "Post Author", then "Post author is the same as the logged in user"

This will display posts as created by the currently logged in user.

So, if you already only return these posts, the filter will not show other parents.
But, you cannot limit the parent post filter to "Posts that the current user created" only.

I have submit this as a feature request.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.