October 9, 2013 at 4:45 pm 8876
|James||Hello, I have recently purchased this plugin and it's great, it's doing exactly what I need of it, so thank you very much for that. There is however a problem on my site which has nothing to do with WPUF but I was wondering if I could use WPUF to work around it. I've got a review system on the site and it's not that great, it's causing many problems and I want to find an alternative. I have come up with an idea using WPUF but it's dependant on a few things. So the idea actually came from another member of the WP forum and I'm hoping I can do it with WPUF. I want to create a form in WPUF and call it "Review Form" and in there have a number of dropdowns to select your score, and a textarea for optional comments. This would create posts to a custom post type called "Reviews". This form would then display at the end of each "normal" post, that requires the review, and I'd do a custom query to get all submitted reviews linked to that post. This final part is the bit I'm struggling with. I'd need to somehow link these review posts to the parent post. I was thinking of maybe doing this by having a hidden field on the form which has an identifier so that I can query that in order to get the relevant review posts. I could maybe do this by adding a custom field of "review_id", create a variable of the main post name or ID and feed that into the review_id custom field. This way, all posts made on this review will have a review_id value which equals the main post title (or ID to make it a bit more secure), then I can custom query that to display all the relevant posts. Could this be done in any way with WPUF? Or is there maybe another way to achieve this? Thank you, and apologies for the lengthy post.|
October 9, 2013 at 6:14 pm 8877
You’ve to use action hook, take a look at this example.
October 9, 2013 at 6:21 pm 8879
Thank you so much for this!
October 10, 2013 at 9:26 pm 8921
Okay, so this is working fine but I am having trouble getting the parent post ID into the value of the input in the function.
Do you know how the best way to do this would be? Someone suggested putting $post->ID where the function is being called but I can’t find where the function is being called.
The $parentPostID is the variable containing the parent post ID.
October 14, 2013 at 3:42 pm 8988
Apologies for multi-post but I managed to get this to work with:
At the top of the function. Just leaving this here if anyone else needs it.