Skip Navigation

[Resolved] bookmarking a post on check and uncheck

This support ticket is created 5 years, 6 months 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by anthonyG-6 5 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1365331
issue1.jpg

as you can see in image I submitted my issue

I create post type tailors

post type bookmarks

relation between them created

add bookmark form created

submitted the add bookmark info using the form but after that i am stuck how to show delete post like with submitted form post id and also same form again to make check uncheck work without page reload in a loop.

#1365475

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

"work without page reload in a loop"

That's not possible, a page reload is required.

It can, of course, be done, clicking the icon to submit a form to connect the post to a bookmark post, and replacing the icon with a link to delete the bookmark post, all via ajax without a page reload, but Toolset Forms isn't geared up to enable you to do that.

It requires a custom solution, both on the front end and the back end, to handle submitting an ajax request, responding to that with PHP code that creates the connected bookmark post, and managing the response to update the UI to offer a link to delete the bookmark post via ajax and set up the create bookmark link again.

The only part of that which I can really help with is that when you create a bookmark post you will need to connect it to the post being bookmarked, for which you would use the toolset_connect_posts API function: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

You may find it easier to use a dedicated plugin for bookmarks/favourites/likes etc., such as hidden link which I know other users have had success with in the past.

#1365655

thanks the plugin works for me

but now the list of saved tailors page I am trying to use the view but how to pass my custom filters for post ids

I have a shortcode for list of favorite posts
[user_favorites]

#1366183

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2019-10-22 at 11.16.38.png

Does the user_favorites shortcode output a comma-separated list of post IDs?

You can add a Query Filter to your View to set the post IDs, as shown in the screenshot.

Note that you are going to pass the IDs in a shortcode attribute "ids".

So, where you insert the View, using a shortcode, you can add such an attribute with the values coming from your user_favorites shortcode, like so:

[wpv-view name="my-view" ids="[user_favorites]"]

You will first need to go to Toolset > Settings > Front-end Content and register the user_favorites shortcode so that it can be used as a shortcode attribute.

You can read more about passing values to Views filters here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#1367343

My issue is resolved now. Thank you!