Skip Navigation

[Gelöst] Show special 404 message when visiting draft

This support ticket is created vor 4 Jahren, 6 Monaten. 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: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Waqar vor 4 Jahren, 6 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1630903

Hi there

On our member platform, users can submit posts (the standard wordpress posts). The posts are saved as drafts and will be published once an admin checked them.

For users, that is confusing, because when they want to visit their new post, they end up on a 404 page (at least until the post is public).

My question is, if it's possible to have a special layout assigned to that particular case, that lets the users know, that their post is in draft mode and not yet published. We already use that feature to inform non-logged in users that they have to log in first to access the content. However, that only seems to be possible for the "Read" capability.

Is there a solution for our case? Maybe in a different way?

Thanks for your help.

#1631601

Hi,

Thank you for contacting us and I'd be happy to assist.

By default, the users with "Author" role and up, can view and edit their posts in the "draft" status, while logged-in.

And likewise, the users with the "Contributor" role can submit and view/edit their posts in the "Pending" status, which an admin can approve later.

But if on your member platform, you're not setting your members as authors of the posts that they submit or members don't have the "edit_posts" capability that is needed to view their own draft posts, then you can use a different workaround.

You can add a new select type custom post field, for example, "Is approved" with your posts, with two possible values; "yes" or "no". All posts when submitted will have the published status, but for this "Is approved" field the default value will be "no".

When admin needs to approve a certain post, this field's value can be set to "yes". And on the front-end, where ever you're showing these posts, you can include a conditional check to only show the post's content, if the value of "Is approved" field is "yes".
( ref: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/ )

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar