I have a new toolset site that has a Resource Profile Custom Post type.
I have two Post forms, one that allows them to create a profile (using cred_form_validate to make sure they can only create one profile), and one that allows them to edit the profile.
I want to have a "My Account" page that shows the Create Resource Profile Form if they haven't created one yet, and the Edit Resource Profile Form if they already have created one. is this doable with a Toolset Conditional shortcode/block?
Is there a way to use the "Custom Function" conditional statement and WordPress's count_user_posts function to do this maybe?
This is a little bit out of my range of abilities, but I think with these two things it is possible to conditionally show one form over another based on if the logged-in user has already published at least 1 post?
I also dont understand what it means in the conditional block by "Functions need to be registered in Toolset" part, is there any documentation on that?
https://developer.wordpress.org/reference/functions/count_user_posts/
Hello, the most straightforward way to do this is with a View instead of a conditional. Set the View to display the Resource Profile post type, and add a Query Filter to filter by post author where the author is the current logged-in User. If you cannot see the Query Filter panel, scroll to the top right and click "Screen Options". You can activate the panel here. Set a limit of 1 result. If you cannot find the limit settings, check Screen Options again.
Now in the loop of the View, you can include whatever you want to show a User who already has a post created. In the "No items found" section, you can include whatever you want to show a User who has not already created a post. This technique is explained in the first FAQ item here: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
I also dont understand what it means in the conditional block by "Functions need to be registered in Toolset" part, is there any documentation on that?
FYI, this documentation is available here: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-custom-functions-in-conditions/
That worked like a charm! thank you I never thought about using a view loop like that.