Skip Navigation

[Resolved] I am trying to delete the relationship using this code

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

Problem:

I am trying to delete the relationship using this code :

[cred-delete-relationship role_items='$fromViews' relationship='cbookmark' redirect='self']Delete this relationship[/cred-delete-relationship]

It does not show the delete button.

Solution:

You can delete the intermediate post, the post type relationship will be deleted too.

Relevant Documentation:

This support ticket is created 5 years, 1 month 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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Mario 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1369539

Yang that worked perfectly.

I am trying to delete the relationship using this code :

[cred-delete-relationship role_items='$fromViews' relationship='cbookmark' redirect='self']Delete this relationship[/cred-delete-relationship]

It does not show the delete button. I have updated the access control seekers, authors and cbookmarks but still not showing.

The above code has been placed with the post view "view-bmk-seek-connect-3":

As this finds both the posts and checks if the relationship exists.

#1369701

Hello,

You can follow our document to setup the "delete relationship link":
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/editing-existing-connections-between-related-posts/#deleting-existing-connections-between-posts

section "Deleting existing connections between posts".

In your case, it needs a child post view:
- Query "cp-Providers" posts
- Filter by post type relationship between "Seekers" and "cp-Providers"
- And display the "delete relationship link" shortcode

#1373033
lc-toolset-3737-min.png

Hi Yang

I have created a new view: "cp-prov-find-relationship-view"

Still not finding the record - I have attached the view.

The view is used with in the "care-seeker-provider-view" page

#1373603

Thanks for the details, I am checking it in your website, will update here if there is anything found

#1373609

I have done below modifications in your website:
1) Edit the post view "view-bmk-seek-connect-3"
hidden link

in section "Loop item in view-bmk-seek-connect-3", line 3, replace this codes from:

[cred-delete-relationship role_items='$fromViews' relationship='cbookmark' redirect='self']Delete this relationship[/cred-delete-relationship]

To view's shortcode:

[wpv-view name="cp-prov-find-relationship-view"]

So view "cp-prov-find-relationship-view" will act as child view of "view-bmk-seek-connect-3"

2) Edit post view "cp-prov-find-relationship-view":
hidden link
in section "Loop item in cp-prov-find-relationship-view", line 2, replace this codes from:

[cred-delete-relationship role_items='$fromViews' relationship='cbookmark' redirect='self']Delete this relationship[/cred-delete-relationship]

To:

[cred_delete_post_link action='delete' post='[wpv-post-id item="@cbookmark.intermediary"]' message='Are you sure you want to delete this post?' message_show='1' class='cred-refresh-after-delete']Delete this relationship[/cred_delete_post_link]

After user click delete link, it will delete the intermediate post, so delete the post type relationship too.

Please test it again, check it is fixed, thanks

#1374201

My issue is resolved now. Thank you!