I am trying to: prevent users from creating more than one Profile (Custom) CPT post
Link to a page where the issue can be seen: hidden link
here the view code that I have added into the loop
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="modello-di-contenuto-perprofili"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"][cred_form form="mio-profilo-form-crea"][/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
I'm using the following guide https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#faq
I expected to see: So, because I have created also a user Profile CPT post, I expected to see My Profile Page
Instead, I got: the Create Profile Form.
Hi, it looks like there could be a problem with the filters. Can you edit this View and take a screenshot of the Query Filters panel? If you cannot see the Query Filter panel, scroll to the top right corner and click "Screen Options". You can activate the Query Filter panel here.
You can also try disabling cache for this View to see if it makes a difference:
[wpv-view name="Your View Name" cached="off"]
Thanks for the reply, I've tried to add cached="off" but the problem is not solved...
For the Query Filter see the attached image.
Okay thank you for testing. The filters look fine, and your code looks correct. There must be something else going on.
- What is the status of the Profili post you created? If it is not Published, you must add a post status filter.
- Did you create the Profili post in the primary language, or in a secondary language?
- Did you create the Profili post in Forms, or did you create the post in wp-admin?
- What is the translation setting for the Profili post type?
- If you temporarily deactivate all plugins except Types and Views, and activate a default theme like Twenty Nineteen, is the problem resolved?
Ok, I displayed the Create Form because the profile post was in pending mode...
I have published the profile post and now it should open the Profile Post, but it display only the Content Template without my fields.
What is wrong?
I'm following this solution https://toolset.com/forums/topic/add-link-to-profile-post-in-menu/#post-1169515
The system return me this message:
Il contenuto non verrà visualizzato perché produce un ciclo infinito.
Lo shortcode wpv-post-body è stato richiamato più di una volta con l'attributo view_template="modello-di-contenuto-perprofili" attraverso l'articolo "InOnda", attivando un ciclo infinito.
It looks like you have included the Content Template "modello-di-contenuto-perprofili" inside itself, which is producing an infinite loop. For example, if you have a Profili post with this Content Template applied to the single Profili post, then try to insert this View inside that Content Template, it will produce an infinite loop because you have included the Content Template inside itself. You must choose a different Content Template for this post, or you must choose a different Content Template in the View.
Ok, but with the View that I have created to create the Profile CPT post I want to have that:
If the post author is different to the current user display the Form to create the Profile CPT post, else display the current user Profile CPT post.
Than to display he current user Profile CPT post I have added this string into the loop
[wpv-post-body view_template="modello-di-contenuto-perprofili"]
but it generate the infinite loop...
To do what I need what should I do?
If the post author is different to the current user display the Form to create the Profile CPT post, else display the current user Profile CPT post.
But you're already showing the current User Profile CPT post, right? So this just creates an infinite loop. You must choose a different Content Template for the single Profili posts, or you must choose a different Content Template in the View. You cannot use the same Content Template in both places.
No, I'm in a Page where I want to dispaly the Profile CPT post Form to create the Profile, and if the Profile is already created I want to display the Current user Profile CPT post.
I'm trying to do that because I want to call the Page "My Profile" and insert it into the main menu.
Is "My Profile" a Page, or just a Content Template? If it's a Page, what Content Template is applied to the My Profile page?
What Content Template is applied to the crea-profilo page?
So "My Profile" will be the crea-profilo page new name.
See the attached image for all information
The error message mentions a post called "InOnda". Can you check this post and tell me if any Content Template is applied? If not, I'll need to log into your admin area and see what's going on. I will activate private reply fields here.
Yes, the post called "InOnda" is my Profile CPT post, and the Content Template "modello-di-contenuto-perprofili" is the Content Template for all Profile CPT posts.
So, if this is the issue that generate the infinite loop, what I need to do to display the Current Login user Profile CPT post without generate the infinite loop?
the post called "InOnda" is my Profile CPT post, and the Content Template "modello-di-contenuto-perprofili" is the Content Template for all Profile CPT posts.
Let me summarize for you:
1. You have a Content Template applied to Profile CPT posts.
2. Inside that Content Template is the View.
3. Inside the View is the same Content Template from #1.
4. This this generates an infinite loop.
To fix it, you should edit the modello-di-contenuto-perprofili Content Template and remove the View. Include other Profile information here. Then disconnect the modello-di-contenuto-perprofili Content Template from all Profile posts. Next, create a new Content Template and insert the View. Assign the new Content Template to all Profile posts.