Skip Navigation

[Resolved] Display draft posts for logged in users

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

Problem:
The user would like to display draft posts for logged-in users.

Solution:
There are two ways to achieve this:
1. Using two views, that are displayed conditionally based on the logged in users.
One view will be displayed to non logged in users.
Another view will be displayed to logged-in users. In this view, add a query filter on post status to choose the statuses that you want to display. Check this article https://toolset.com/documentation/user-guides/views/filtering-views-query-by-post-status/

2. Using one view, and altering the query filter programmatically. You can use the wpv_filter_query and if the user is logged in, add the other statuses to the view's query arguments.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

This support ticket is created 4 years 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by irfanA 4 years ago.

Assisted by: Jamal.

Author
Posts
#1906515

Opps there is still one more issue
1. As one Add A New Business via Front end From post goes to Draft for review.
2. So use on front end cannot see the post in view as it is not published so need help here as well as want to show in view all post for login user either Publish or saved as Draft.
3. If A use change the status to from Draft to Publish or Publish to Draft for guest User "View should show only Publish Post"
4. Please don't make any changes in this 1st do suggest me.
Thanks.
5. I have created a post with test that can be use as test case.

#1906519

I can see two ways to achieve this:
1. Using two views, that are displayed conditionally based on the logged in users.
One view will be displayed to non logged in users.
Another view will be displayed to logged-in users. In this view, add a query filter on post status to choose the statuses that you want to display. Check this article https://toolset.com/documentation/user-guides/views/filtering-views-query-by-post-status/

2. Using one view, and altering the query filter programmatically. You can use the wpv_filter_query and if the user is logged in, add the other statuses to the view's query arguments.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

I hope this helps. Let me know if you have any questions.

#1910455

Hi Jamal,

Thanks once again, I have created second view now the issue is what is the best and easiest way to update the post status via front end. I have prepared and Edit From but how I can put all status so that empleyee can change the status accordingly.

New threads created by Jamal and linked to this one are listed below:

https://toolset.com/forums/topic/update-post-status-from-the-frontend/

#1910457

another point is to to add Post status into search filed so that once can search post based on Post Status.

New threads created by Jamal and linked to this one are listed below:

https://toolset.com/forums/topic/filter-view-by-post-status/

#1910563

Awesome. I am glad I could be of help.

However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason, I have created other tickets to handle your last questions.

#1912129

My issue is resolved now. Thank you!