Hi @pressonforlife
I hope you are doing well today.
I think you should look for some Events or Contest plugin, as in such scenario, Forminator will create dozens of entries. I tried to replicate your scenario on my lab and no matter which raod I pick up I end up with unreadable data. Please take a look:
- First, on page 1, I created a Forminator form, which allowed me to grab the user name and email. After login, the user is redirected to page 2 with the 2nd Forminator form, which collects data from his account (name and email), and the form creates a post in the Competition where the user selected also a category. Note that this is related to the Post Data field, and it works this way. If 100 users will register and submit the same form for the same category, you end up with 100 new posts for that category in the Competition post type. Of course, you can sort those on the Competition page, but each time you need to enter each post to see which user submitted this form.
- Later on, on page 2, I created a Forminator form which mix 2 things: collect name and email + allow to choose category. This also creates a post in the Competition where the user selected the category. Again, this is related to the Post Data field, and it works this way. If 100 users will submit the same form for the same category, you end up with 100 new posts for that category in the Competition post type. Of course, you can sort those on the Competition page, but each time you need to enter each post to see which user submitted this form.
As you can see, this is not the perfect solution, and your goal, if I understand correctly, is to have a post type with categories and posts (12 in this case), and in post no.1 (example: MasterChef), you would like to see how many users apply there, which is not possible as each submission for MasterChef will be separate MasterChef post with different name and email.
Please let me know if we are on the same page.
Kind Regards,
Kris
Thread Starter
Presson
(@pressonforlife)
Thank You very much for your reply.
We will use just one Category to reason the case:
COOKING:
a.)MasterChef.
b.) GT Food Festival.
c,) Zenith Chef Hackathon.
d.) WemaBank Food Blast.
The Cooking Category has 4 Competitions/ Events under it: and if 50 people submit Application to each of the Competitions under the Cooking Category, normally, I should have 200 Posts (Contestants) within the Cooking Category.
For me, this is correct ( MasterChef = 50, GT Food Festival = 50, Zenith Chef Hackathon = 50, WemaBank Food Blast = 50 || Cooking Category Overall Posts {Contestants} = 200 ).
It’s more like saying there are 4 different Events, and 50 people applied to each of the Events: the overall number of people that applied to all four(4) events is 200, and for me, that math is correct.
What I need afterwards, is how to filter out the Contestants for each specific Competition, and get Forminator to Post the Data to each specific Competition.
Needing to hear from you soon.
Regards.
Hello @pressonforlife
You can map the formintor post form to ACF custom fields just need to create the custom field with same field ID in Forminator, please take a look at this document to learn more:
https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#custom-fields
You need to create a custom link that pass competition information using a query string that you can prefill a field in from to save that data.
https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#pre-populate-form-field-values
Regarding the filters, you may need to use custom code or if the field data is properly mapped through ACF, you can use the ACF filters.
Best Regards
Amin
Hi @pressonforlife
We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!
Kind Regards,
Kris
Thread Starter
Presson
(@pressonforlife)
I don’t think there’s any way to do it normally in Forminator!
I was able to get a PHP code Snippet that does it, and thought to leave the code here, for those who might face a similar situation:
———————————————————
function generate_apply_now_button_shortcode() {
// Get the current post ID
$post_id = get_the_ID();
// Get the base URL of the Forminator form page
$form_page_url = home_url('/application/');
// Construct the full URL with the competition_id query parameter
$button_url = add_query_arg('competition_id', $post_id, $form_page_url);
// Use output buffering to capture and conditionally output CSS
static $css_added = false;
$style_html = '';
if (!$css_added) {
$style_html = '
<style>
.apply-now-button {
display: inline-block;
width: 20%;
margin: 10px 0;
padding: 0 .5rem 5px .5rem ;
background-color: #3bb44a;
color: #fff;
font-size: 1.375rem;
text-decoration: none;
transition: all 0.3s ease-in-out;
border-radius: 1rem;
font-weight: bold;
text-align: center;
}
.apply-now-button:hover {
background-color: #90ee90;
color: #000000;
}
</style>';
$css_added = true;
}
// HTML for the button with a class
$button_html = '<a href="' . esc_url($button_url) . '" class="apply-now-button">Apply Now</a>';
return $style_html . $button_html;
}
add_shortcode('apply_now_button', 'generate_apply_now_button_shortcode');
———————————————————
Thanks for all your guidance.
Regards.
Hello @pressonforlife
We are glad that you were able to fix the problem.
Thank you for sharing the working snippet; indeed, it could be useful for other users.
Best Regards,
Amin