Skip Navigation

[Resolved] CRED form for editing relationship content from within post type

This support ticket is created 6 years, 3 months ago. 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)

This topic contains 7 replies, has 2 voices.

Last updated by Christian Cox 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1136105

Hello -

I have a situation sililar to the song - track - album set-up. Everything is working fine in the standard WP admin edit area, but I'd like a front end form for editing albums which allows me to edit the track of songs on the album all at once per each album. (I have a many many relatioship set up between songs and albums, with a relationship field of 'track') I have a post form which allows me to edit the custom fields for the custom post type 'album'. How can I make a code block in that form which will show all songs on the album and allow for editing the track? Do I need an entirely seperate form for this? Any help welcome.

Thanks,
Chad

#1136210
Screen Shot 2018-10-29 at 3.59.32 PM.png
Screen Shot 2018-10-29 at 3.56.02 PM.png
Screen Shot 2018-10-29 at 3.54.01 PM.png

A little more:

So, I've managed to get a bit in. I have a relationship form for an Intermediary Post Type for Instructions-Steps Which connects Steps to Instructions and vice versa. These have a relationship post field "step-order-number" which is used to order the steps associated with an instruction. Have used this form in an edit template by using Create an "editing-mode" form. In the other image is the result.
What happens though is that this will only let me associate steps not previously associated to the current instruction. When I try to use it to call up an instruction-step associated to the instruction I'm looking to edit the Step Order Number for, it gives me "No step can be associated to.."

#1136299

How can I make a code block in that form which will show all songs on the album and allow for editing the track? Do I need an entirely seperate form for this?
The short answer is yes, in the current system a single Form can only add/edit a single post, or add/edit a single relationship instance. More than one cred-relationship-form-container shortcode isn't supported in a Form editor for this reason. We hope to add some improvements to Forms that will enable an experience more like managing repeating field groups in wp-admin, but right now separate Forms are required to add/edit each post or add/edit a relationship between two posts.

To accomplish something kind of like this in the current system, you can check the solution I provided in another ticket for a general idea: https://toolset.com/forums/topic/share-a-custom-post-type-in-another-custom-post-type/
It doesn't help you create or edit multiple Steps at the same time, but it can help you streamline the process of creating Step posts and relating them to the current Instructions post. Let me know if you have questions about that.

#1136325

Thanks will check out the provided solution and see if I can I adapt. Would duplicate relationship forms as edit mode templates be a possible solution in the same layout? Conversely, any way to put a relationship edit mode template inside a view loop?
Thanks,
- Chad

#1136802
Screen Shot 2018-10-30 at 9.59.24 AM.jpg

New Question may be simpler: Is there a way to get an edit field for a relationship field into the WP standard All page for the intermediate post? See image example would be the relationship field step-order-number. This coupled I think with a reorder plugin would likely do it sufficiently.
Thanks again,
Chad

#1136834

Would duplicate relationship forms as edit mode templates be a possible solution in the same layout?
I don't understand, sorry. Could you show me a mockup of what you had in mind?

Conversely, any way to put a relationship edit mode template inside a view loop?
There's technically nothing to stop you from placing Forms in a View and using the field value attributes to predefine the selected values, but it's not recommended. There could be unexpected issues with this approach.

Is there a way to get an edit field for a relationship field into the WP standard All page for the intermediate post?
It isn't provided by Toolset but there are other 3rd-party plugins out there that claim to allow bulk-edit of custom fields. I can't vouch for their effectiveness, but might be worth a shot.

#1137594
Screen Shot 2018-10-31 at 10.20.26 AM.png
Screen Shot 2018-10-31 at 10.16.00 AM.png

Okay, I'm almost there, I opted for a third party plugin to manage the quick edit field addition. Everything is working perfectly except that since Toolset gave me a slug with _2 on the end of it, its doubling the display of my number in the edits column. Is there a way I can either safely change this slug, or a php trick you know of I can do to remove the number doubling?

#1137765

Everything is working perfectly except that since Toolset gave me a slug with _2 on the end of it, its doubling the display of my number in the edits column.
I don't think a slug ending in _2 should be problematic this way, but I could be wrong. Regardless, the code you shared doesn't manipulate the number shown in the column, it manipulates the title of the column. Is there any additional code related to displaying the custom field value? The standard action ends in _posts_custom_column.