I wish to give the front end user the ability to delete a relationship they have set previously.
I have followed the tutorial however the delete relationship link has no effect
I have tried both one to many and many to many.
Please can you advise
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Hi Graham
I just tried this out on a local test site and it worked as expected.
I have "Lefts" and "Rights" connected in a m2m relationship, with several sample connected posts.
In a View inserted on the template for single Left posts that displays connected Rights, I included a link to delete the relationship (as described here: 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 ), and that link looked like
[cred-delete-relationship role_items='$fromViews' relationship='left-right' redirect='self']Delete this relationship[/cred-delete-relationship]
When, on the front-end, I clicked the link, it deleted the relationship between Left and Right posts (but didn't delete the posts themselves).
I went onto your site and tested the same—and found the same.
On the Acme Company client page there is a View listing connected Projects, with delete relationship links.
When I first loaded the page the projects 10, 12, 14 and 16 were connected.
I clicked the link to delete the relationship with project 10, and that's exactly what happened (as confirmed in the backend, see screenshot).
Perhaps you are expecting something different?
Aha. thank you for the reply Nigel.
I think I have found the issue, unless you are logged in as admin the delete relationship does not work.
I have created a new user as a subscriber or editor (un:tester pw:password) and it does not work. Only if you are logged as administrator.
I need my users as subscriber to be able to delete the relationship.
Any ideas?
Graham
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Subscribers don't have rights to publish/edit/delete posts by default, so you will need to add the Access plugin to the mix and give permissions to subscribers to delete the intermediate post type.
https://toolset.com/documentation/user-guides/setting-access-control/
My issue is resolved now. Thank you!
🙂