Sauter la navigation

[Résolu] How do I prevent users from creating more than one Profile (Custom) CPT post?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to let Users create a Profile post with Forms. However, I would also like to prevent Users from creating more than one Profile post.

Solution: Use a View of Profile posts, filtered by post author, set by the current logged-in User. In the "No results found" area of the View, insert your Form to create Profile posts. In the results found section of the View editor, display an alternate message.

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#faq

100% of people find this useful.

This support ticket is created Il y a 6 années. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 25 réponses, a 2 voix.

Dernière mise à jour par francescoG-3 Il y a 6 années.

Assisté par: Christian Cox.

Auteur
Publications
#1183715

Hi Christian,
the summarize is not correct because:
1. I have a Content Template applied to Profile CPT posts. YES
2. Inside that Content Template some modules are managed with View.
3. Inside the View is the same Content Template from #1. YES

Now I'm trying to fix following your guide:
1. Edit the modello-di-contenuto-perprofili Content Template and remove the View (what do you mean with "Include other Profile information here"?)
2. Disconnect the modello-di-contenuto-perprofili Content Template from all Profile posts
3. Create a new Content Template and insert the View
4. Assign the new Content Template to all Profile posts

#1183772

We don't understand each other. Please provide login credentials in the private reply fields here so I can figure out what is going on here.

#1183784
infinite-loop.png

Please see the infinite loop in this screenshot. This will render the contents of the Page:

{!{wpv-post-body view_template="None"}!}

The contents of the Page includes the View.
The View includes the Divi template.
The Divi template includes the wpv-post-body shortcode.
The wpv-post-body shortcode renders the contents of the Page.
The contents of the Page includes the View.
Repeat ad infinitum - it's an infinite loop.

To fix it, you must remove the wpv-post-body shortcode from the "Testo" block of your Divi template.

#1183808

Do you think that is good to create a Text Custom field to manage the description text content inside the Profile CPT post instead using the default wordpress content form?

#1183813

It might be okay, but it depends on many factors. Custom fields are not automatically indexed for search. They are also translated differently than post content. If you have specific questions about that, feel free to open a separate ticket.

#1183816

Ok, but I think there are not other solution to have a description into Custom Template without generate loop in View...

#1183827

So, I have changed the wpv-post-body with the "descriviti" custom field. Now I don't have the loop error message, but the fields about the current user Profili CPT Post are not displayed.

So, I need to display the current user Profili CPT post in a page (My Profile) to add the page into the menu.

What is wrong in the code?

#1184358

Inside the Divi template, you can add the current post ID to each shortcode, like this:

{!{wpv-post-author format="meta" meta="nickname" id="{!{wpv-post-id}!}"}!}
...
{!{wpv-post-taxonomy type="occhi" format="name" id="{!{wpv-post-id}!}"}!}

Now the shortcodes refer to the current Profili post in the loop of the View.

#1184558

Hi Christian,
thanks for more shortcode it work fine and now the page looks like Profile CPT post.

But it don't work to display the "Sono di - Mio Profilo" View that it should display the current user position. I have duplicated all relative Content Template and add to the title name the " - Mio Profilo" string, and added to the shortcodes the "wpv-post-id", but nothing.

Other issue is in the gallery, I don't know why near the images are displayed "']" for every single image.

Now I'm trying to adeguate the shortcode to display the age and the category lists.

Les nouveaux fils créés par Christian Cox et associés à celui-ci sont repris ci-dessous :

https://toolset.com/fr/forums/topic/bracket-displayed-near-every-image-gallery/

#1185107
Screen Shot 2019-01-16 at 8.30.42 AM.png

But it don't work to display the "Sono di - Mio Profilo" View that it should display the current user position. I have duplicated all relative Content Template and add to the title name the " - Mio Profilo" string, and added to the shortcodes the "wpv-post-id", but nothing.
The Sono di - Mio Profilo View had a post relationship filter that was set by the post where the View is shown. See the attached screenshot. I already changed it for you, so now it responds to a shortcode attribute "wpvrelatedto". In the Divi template, I replaced your View shortcode with this one instead:

<div>{!{wpv-view name='sono-di-mio-profilo' wpvrelatedto='{!{wpv-post-id}!}'}!}</div>
#1186031

My issue is resolved now. Thank you!