Hi,
I was discussing this previously here: https://toolset.com/forums/topic/unlock-content/ but the thread closed on me. Basically I would like to set up a function that once you submit a CRED Form, it adds the ID of the custom post type "listing" to the repeating field "listing_ids" within the custom post type "profile". At the same time I would like to decrease the numeric field "remaining_listings" by 1 which can be found within the "profile" Post type.
The post types look like this:
- Listing (ID)
- Profile
-- listing_ids (repeating numeric field) // designed to contain all the listing IDs
-- remaining_listings (numeric field) // designed to count down to 0
Not sure where to even begin ...
The previous post suggested creating a CRED Form that only has a submit button and use the cred_save_data hook to do this, but I am not sure if the form should be editing the listing it is being placed on, or the profile associated with the user currently logged in.
I have a shortcode that can retrieve the ID of the profile associated with the currently logged in user.
Any help would be greatly appreciated.
Thank you
Ok so I ended up going with a different solution and created my own plugin and functions. No need to rely on CRED for this as I would be overcomplicating everything.