Skip Navigation

[Resolved] Relationship Edit Link Duplicated

This support ticket is created 5 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by duongN-3 5 years ago.

Assisted by: Waqar.

Author
Posts
#1379225

Tell us what you are trying to do?
Adding Edit function to a Drama title
Edit is duplicated showing multiple edit links under a Person

Is there any documentation that you are following?
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/editing-existing-connections-between-related-posts/

Is there a similar example that we can see?
hidden link

What is the link to your site?
hidden link

Original ticket: https://toolset.com/forums/topic/edit-remove-connection-not-working-as-expected/

#1379583

Hi,

Thank you for contacting us and I'd be happy to assist.

Since the view "Edit Link for Cast-Dramas" is set to show all the "People" posts, which are related to the current "Drama" post, it's output loop is repeating, equal to the number of people posts, connected to the current drama.

To make sure that only the relationship edit link for a single current people post is shown, you can follow these steps:

1. In your view "List of Drama Credits", you can include the current people post's ID in a shortcode attribute.
( ref: https://toolset.com/documentation/user-guides/passing-arguments-to-views/ )

Example:

The current shortcode:


[wpv-view name="edit-link-for-cast-dramas"]

Updated shortcode:


[wpv-view name="edit-link-for-cast-dramas" people="[wpv-post-id item='@cast.child']"]

2. In the child view "Edit Link for Cast-Dramas", you can wrap the relationship edit link in a conditional block, so that it only shows, when the current people post ID and the ID of people post coming from the parent view is the same:
( ref: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/ )


[wpv-conditional if="( '[wpv-post-id]' eq '[wpv-attribute name="people"]' )"]

[cred-relationship-form-link form='edit-drama-cast' role_items='$fromViews' content_template_slug='editing-cast-drama']Edit[/cred-relationship-form-link]

[/wpv-conditional]

As a result, only a single edit link will be shown for each "people" post.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1380289

Thanks Waqar!
This has solved my issue, but I have one other question related to the edit link.

Currently I have "Add Cast" to look like this:
hidden link

I'd like to have "Edit Cast" look the same way, but it looks like this:
hidden link

As you can see the content on the left side doesn't show anything.
I'm using a Content template titled "Editing Cast-Drama" and my code looks like this:

<div class="row">
	<div class="col-sm-8">[wpv-post-body view_template="template-for-dramas" parent_item='$current']</div>
  <div class="col-sm-4" style="margin-top: 200px;"><h3>Editing Cast</h3>[cred-relationship-form form='edit-drama-cast' parent_item='$current']</div>
</div>

Can you assist with this?
Thanks again for everything.

#1380555

Hi,

Thanks for the update and glad that it works.

In your content template "Editing Cast-Drama", you have this shortcode to load the drama's content:


[wpv-post-body view_template="template-for-dramas" parent_item='$current']

Since the edit cast form shows on the single cast page and not on the single drama post page, you'll need to update it to use item="@cast.parent".
( ref: https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/ )


[wpv-post-body view_template="template-for-dramas" item="@cast.parent"]

I hope this helps and you're welcome to start a new ticket for each new question or concern.

regards,
Waqar

#1381617

My issue is resolved now. Thank you!