• Resolved Presson

    (@pressonforlife)


    Hello Sir,

    I need to create a Contest website with WordPress, Woo Commerce and Advanced Custom Fields (ACF), and Forminator Form.

    This Contest website allows people to apply to a Competition to compete for a prize.

    1.) Now, with Advanced Custom Fields (ACF), I have created a Custom Post Type called “Contestant” and each “Contestant” Post is a person that will compete for the prize, in a Competition.

    2.) With Advanced Custom Fields (ACF), I have created another Custom Post Type called “Competition” and each “Competition” Post is a contest that each person (contestant) will apply for, to compete in.

    3.) I have created a Forminator Form used to submit Application to the Contestant Post, which therefore creates a Contestant.

    THE PROCESS
    Once I create a Competition Post and it is published, there will be a Start Date and End Date on that Page.

    On that Competition Post, there will also be a button on that Page that says “Apply“, and this button when clicked, will lead to the Page where I have the Forminator Form.

    QUESTION
    How do I make Forminator to know which Competition/ Event to send the submission to, when there are many Competitions ?

    THE PROBLEM
    I could have Competitions like “Masterchef, PhotoLords, and BibleKing” and so on — which belong to the Cooking, Photography and Religion categories, respectively, as seen below.

    COOKING:
    MasterChef
    GT Food Festival
    Zenith Chef Hackathon
    WemaBank Food Blast

    PHOTOGRAPHY:
    PhotoLords
    Peller Blitz
    Ledeon Views
    TeenaKenny Impressions

    RELIGION:
    BibleKing
    Redeemed Quiz
    Winners KnowHim
    Elevation Superstars

    EXPLANATION
    What I have done above, is create 3 Categories (Cooking, Photography, Religion) which have at least, 4 Competitions, OR Competition Posts of the “Competition Post Type” in each one of them.

    THE EXPECTED PROCESS
    Yet, I need to have one Forminator Form on the website, and each Competition Post will have an “Apply Now” button, that leads to the Page where I have the Forminator Form.

    How do I make Forminator intelligent enough to know which Competition the user is applying for, and send the submitted Data to that specific Competition ?

    Regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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:

    1. 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.
    2. 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.

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    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.

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    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

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘One Form, multiple separate submissions’ is closed to new replies.