Skip Navigation

[Resolved] Toolset form: set post visibility

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)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 9 months, 4 weeks ago.

Assisted by: Waqar.

Author
Posts
#2680123

I'm creating a site where visitor can create an account and after that he can create custom posts with toolset form. Now I want to let the visitor choose the visiblity of the post so that they can keep it private (default) or give it password access or publish it.

Can't find any example how to do this, is it possible?

#2680241

Hi,

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

To achieve this, you can use different Toolset edit post forms, one for each post status change. i.e.

a). Form to set the post status to 'private'
b). Form to set the post status to 'publish'
c). Form to set the post status to 'password protected'

These forms will not have any fields and just the submit button, as the goal of each, will only be to trigger the relevant change in the post status.

The 'Private' and 'Published' post status options are available in the form, out-of-the-box. But for the 'password protected' form some extra customization will be needed.

In that form, you'll need a generic field for a password and then a custom function attached to a 'cred_save_data' hook, to set this post as password protected with that entered password.

You'll find an example of a custom function for a similar requirement, in the following forum reply:
https://toolset.com/forums/topic/password-protect-custom-posts-with-toolset-forms/#post-1452647

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#2680242

Thank you Waqar, that's brilliant!