Sauter la navigation

[Résolu] CPT post Editing Form into a Content Template into a View into a page don't work

This support ticket is created Il y a 5 années et 11 mois. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

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

Dernière mise à jour par Nigel Il y a 5 années et 10 mois.

Assisté par: Nigel.

Auteur
Publications
#1205781

I am trying to Create a Page with an Editing Form about a CPT post where the logged in user is the author and can create only one post, with Divi css style.
And so, I have created the CPT post Editing Form, I have inserted it into a Content Template with the Divi Builder, I have inserted it into the View loop with the filter where the logged in use is the author, and I have inserted the View into the page.

Link to a page where the issue can be seen: lien caché (only if you are a registered user and have created a Profile post)

I expected to see the Editing Form about the CPT post where the logged in user is the author. So, if I insert the CPT post Editing Form directly into the View loop, the page displays the CPT post Editing Form, else, if I insert the CPT post Editing Form into the Content Template and the Content Template into the View loop, instead I got this message "Modulo type e post type non corrispondono".

If you see the link above, first, you can see the CPT post Editing Form inserted directly in the View loop, and if you scroll down the page, you can see the message that returns when the CPT post Editing Form is inserted into the View using the Content Template.

#1206189

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Here is how I recommend you do it.

You have a form to edit profile posts. Insert this form onto the modify-profile page using the Toolset Forms button and, for now, instead of editing the current post specify some profile post that it should edit.

It will insert the form with a post attribute that has the post ID as the value, something like:

[cred_form form='edit-my-profile' post='99']

Now we need to dynamically generate that post ID instead of having a hard-coded value.

So make a View to show the profile post of the logged in user.

I suggest you use the Loop Wizard for the output section and specify the final output option, "List with separators", and include just the wpv-post-id field for the output.

So this View should return just the post id of the relevant profile post.

Meaning you can update your cred_form shortcode, something like this:

[cred_form form='edit-my-profile' post='[wpv-view name="my-profile"]']
#1206644

Thanks for the reply.
Now I have this error Message "Il modulo ’mio-profilo-form-modifica’ di Toolset è inesistente"

#1206929

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

That sounds like a message coming from Elementor?

Where do you see the message?

Editing the form?
Editing the page which contains the form with Elementor?
Displaying the page which contains the form?

#1206991
05-Editprofile-View-that-generate-post-id.png
04-Editprofile-Content-template-with-Form.png
03-Editprofile-page-View.png
02-editprofile-page-content.png
01-editprofile-page-result.png

So, I use Divi Builder not Elementor...
I display the message Displaying the page which contains the View shortcode, that contains the Content template shortcode, that contains the Cred form shortcode with the post id generated by the View that you have write before.
see the attached images

#1207048

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

I mentioned before that I advised using the Loop Wizard for the View that outputs the post id, choosing the "List with separators" output format, but from your screenshot it looks like you didn't do that.

When you use such Views to provide values to shortcode attributes it can be very sensitive to (unseen) whitespace that the View includes, and using the Loop Wizard helps prevent that.

I'm discussing with the devs to trim the output of such Views to remove any whitespace because it means it can be tricky to set that up, but could you please try that?

#1207094
06-Editprofile-View-that-generate-post-id.png

I have done that, see the attached image now, but I have the same message!

#1207321

Nigel, sorry, I write you here, because I need assistance in another thread, about using the relationship posts in child posts custom search and select the value with "Select2".
https://toolset.com/forums/topic/how-to-select-a-related-post-value-from-the-custom-search/#post-1207317

So, in this topic (https://toolset.com/forums/topic/drop-down-menus-for-countries-and-cities-in-dependency/), with the Christian Cox suggestion and Toolset guide, I have used the Toolset Relationship functions, to set some post dependencies. Well, I have created the Profile CPT that it is child of Città CPT, that it is child of Provincia CPT, that it is child of Regione CPT, that it is child of Stato CPT, all with parents with an address custom field.
And so, now I'm trying to create the Custom Search and I cannot add the form to search the posts about its dependencies (parent, grand parent, grand grand parent, grand grand grand parent).
So, a solution that I have thought is to create the relative Address Custom Fields into Profile CPT posts, to dynamically save the values about the Parent, Grand Parent, etc... Address Custom Fields. But I don't know what custom code I need to use...
And also, If there is a solution to do what I need, to integrate the Select2 to select the items in Custom Search, because only the Città CPT have up to 8000 items....

Can you help me on that? Because if there are no solutions to do that, all work and all the time will be lost...
Can I pay to have what I need!!!!

#1207710

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Francesco

Replying to the issue of this thread, somehow we seem to have ended up in a place much more complex than it needs to be.

You have a page to edit the profile of the logged-in user. Currently on your site we have arrived at a situation with a chain of Views, templates, forms, and back to Views.

The solution should just be:

- add a View to the page to create the context of the profile post to be edited (i.e. a View which queries profiles and has a query filter for the post author to be the current user)
- insert the edit form directly in the output section of the View so that it edits the "current" post (i.e. the intended profile)

Is there any reason to not do it like this?

#1207864

So I would like to use the Content Template to Insert some content like the header and the sidebar menu.
But I think to copy the Content Template divi shortcode into the Form editor.

#1207926

Hi Nigel, sorry if I write to you and in this thread.

So, a few days ago I have opened a thread, https://toolset.com/forums/topic/issue-on-installer-page/, where I have an issue to display the Toolset and WPML installation page. In this thread, Minesh solved the issue with a Dev fix.
But, after the last Toolset update, the issue is returned and Toolset system reports me that my Toolset addon is in Lite version because "I don't have the license"...
Well... I have a lifetime license!!!

I have also some issues in Form when I try to delete a duplicated Form. So, the dialog box goes up right on my page, I see only down left angle of the dialog box.

Other code issues I have in View when I try to select the Filter by post relationship / repeatable field groups owner, and don't appear any dialog box. When I click on it, the system return to the Search and Pagination section...

Can you help me to contact a Dev to solve the issues?

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

https://toolset.com/fr/forums/topic/split-issues-from-other-threads/

#1208495

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

OK, you want to use the content template.

I think the last View should be redundant in any case.

Because you already have the first View which sets the context (the profile post of the current user) then the "current" post should be that profile post both in the output of the View and in the template which you insert in the output of that View.

So where you insert the form with the cred_form shortcode, instead of trying to set the post attribute using another View I think it should work if you just use

post="[wpv-post-id]"

for the attribute.

(You could check by simply outputting the wpv-post-id shortcode somewhere in that template and confirming that the id number that it outputs is the id of the profile post to be edited.)

(I've split those other questions into another thread to deal with separately.)

#1208698

So, I have solved not using the Content Template. Well, with the content template I have created the layout with Divi, after, I have deactivated Divi to the content template, and I have copied the Divi Shortcode into the Form, and in the View I have used the Form shortcode. Now all work fine same as I need, and also, before, using the Form, with some Divi shortcode, into a Content Template built with Divi, I had some issue about some redundant css class when I displayed the View.
Now all is fine, but, I want to suggest you, to ask Devs if they can add the possibility to build the Form templates using the Divi builder or other builders, same as Content Template.

#1209458

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Francesco

You could suggest it here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

I must say, though, that most of our development efforts at the moment are about leveraging Gutenberg to design templates and Views etc. so that you don't need to use 3rd party page builders (it takes up a great deal of our developer resources just trying to make and keep Toolset compatible with popular page builders).