Skip Navigation

Edit Relationship

This thread is resolved. Here is a description of the problem and solution.

Problem:

How to setup relationship form to edit connections of many-to-many relationships?

Solution:

You can try these:

https://toolset.com/forums/topic/edit-relationship/#post-2374307

Relevant Documentation:

https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/#deleting-existing-connections-between-posts

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.

This topic contains 6 replies, has 3 voices.

Last updated by acts-1224C 4 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#2372927

I have created a relationship form between a Course and a Student which I named Attendance. It is a many-to-may relationship that allows me to add custom fields to this relationship. The fields are test grades, makeup paper grades, and grade dates.

However, I need an edit form for the custom fields in the established relationship. For every quarter there are new grading and grading date that needed to be added to that student in relationship to the course. I have hundreds of teachers/instructors and I cannot have them login in from the backend.

So I need an edit form that the teacher/instructor can just add the record in the respective custom field that belongs to that relationship.

Please guide me in that. Thanks

#2373927

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

You can follow our document to setup a relationship form to edit the Attendance post and change the intermediate post custom fields:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/#deleting-existing-connections-between-posts
Front-End Forms for Connecting Related Posts in WordPress

#2374183

Thanks, Luo for your response. However, my question goes beyond just connecting posts. That form I have created already. The course lesson/example you gave only shows the connecting posts ability.

My question is, after the post is connected, in my example, student to a course, the instructor needs to add grades. Grades is a custom field in the intermediary post Attendance. I need a way to edit the grades belonging to this existing connected relationship. The year has four quarters, and the instructor needs to add 8 sets of grades during the interim of the course after the posts were connected the first time. This needs to be done on the front end.

#2374307

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Sorry, the document of edit connection was removed, you can try these:
1) Create a relationship form "Edit the connection form", in section "Setting", option "Relationship" choose: Attendance
2) Create a content template "Edit the connection CT", display above form shortcode:
[cred-relationship-form form='edit-the-connection-form']
3) In the single "student" post, display a post view:
- Query "Course" posts
- Filter by post type relationship between "Course" and "student"
- In view's loop, display the "Course" post information + below two shortcodes:
a) Edit relationship link:
[cred-relationship-form-link form='edit-the-connection-form' role_items='$fromViews' content_template_slug='edit-the-connection-ct']Edit this Attendance[/cred-relationship-form-link]
b) Remove relationship link:
[cred-delete-relationship role_items='$fromViews' relationship='attendance']Delete this Attendance[/cred-delete-relationship]

#2374883

Hello Luo, it worked perfectly. I had to do a workaround (like use the old legacy mode)for these codes that did not work with the toolset blocks (for it always displays an error "This block encounter a fatal error". but I follow the logic. thanks

I have one more detail related to this ticket. I can not get two custom field data to display. It only displays the post title connected in the relationship, and it does not show the two custom fields connected in the intermediary post title. Do I have to open a new ticket?

Thanks

New threads created by Waqar and linked to this one are listed below:

https://toolset.com/forums/topic/split-showing-the-two-custom-fields-connected-in-the-intermediary-post/

#2376333

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thanks for the update and glad that Luo's suggestions helped.

He is on vacation so I've created a separate ticket for your most recent question and will follow up on it shortly.
( ref: https://toolset.com/forums/topic/split-showing-the-two-custom-fields-connected-in-the-intermediary-post/ )

You're welcome to mark this ticket as resolved and start a new one, for each new question or concern.

regards,
Waqar

#2376469

My issue is resolved now. Thank you!