Skip Navigation

[Resolved] cred-delete-relationship is not working as expected

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.

Our next available supporter will start replying to tickets in about 0.42 hours from now. Thank you for your understanding.

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 2 replies, has 2 voices.

Last updated by Waqar 1 year, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2603985

Tell us what you are trying to do?
I'm trying to offer a front-end way for my users to disconnect an existing M2M relationship.
In the loop item of the View showing the relationship, I have the following shortcode:

<p>[cred-delete-relationship class="btn btn-outline-danger btn-sm" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" role_items='$fromViews' relationship='coaching-engagements' type="button" redirect='self']Disconnect[/cred-delete-relationship]</p>

When I click the Disconnect button, the page reloads but the relationship is still there?

Is there any documentation that you are following?
https://toolset.com/forums/topic/front-end-editing-of-post-relationships/#:~:text=Click%20the%20link%20to%20see,fields%20associated%20with%20this%20relationship.&text=This%20will%20create%20a%20%22Disconnect,front%2Dend%20of%20the%20site.

What is the link to your site?
hidden link

#2604253

Hi,

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

Do you see any error or warning, on the screen, in the browser's console, or in the server's error log?
( ref: https://wordpress.org/support/article/debugging-in-wordpress/ )

In case there are none, please share temporary admin login details, along with the link to the example page, where this button can be tested.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2604697

Thank you for sharing the access details.

I noticed that the 'cred-delete-relationship' shortcode is being used in the view that is showing the intermediary posts, and not the parent or child posts in the relationship.

In such a case, you'll just need to specify the target parent and child posts, through the 'related_item_one' and 'related_item_two' attributes, without the attribute role_items='$fromViews'.

This means that the current shortcode:


<p>[cred-delete-relationship class="text-danger text-decoration-none" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" role_items='$fromViews' relationship='coaching-engagements' redirect='self']Disconnect[/cred-delete-relationship]</p>

Will need to be changed to:


<p>[cred-delete-relationship class="text-danger text-decoration-none" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" relationship='coaching-engagements' redirect='self']Disconnect[/cred-delete-relationship]</p>

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

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.