• Resolved hollosipeter

    (@hollosipeter)


    Hi! I’m asking your help about this case:

    I have a registration form where people can register to dance class – the last few days you helped me a lot with this what thank you again.
    I now that you have a github where lot of mu-plugins exist but I didn’t why what can do this:
    When somebody registering to my dance classes, they have an option (with conditional rules) that “deleting the registration.
    I’m looking for something what is making an ‘inspection’ when somebody tries to submit a form with check “delete registration” and if the e-mail address or the phone number is exist on an existing form, they get a message about “Sorry, but you didn’t have existing registration”?

    When somebody registering, I’m using “email-1′ and ‘phone-1’ as fields Where somebody tries to delete and they are checking “deleting existing registration” checkbox, I’m using “email-2” and “phone-2”. I like to be that checking that “email-2” or “phone-2” has an existing registration.

    So technically I need when somebody fills email-2 or phone-2, field that checks that e-mail-1 or phone-1 data is already exist in the submissions or not and if yes, this message has to come for the user.
    I know that this is 2 mu-plugins, one for the e-mail check, one for the phone number because maybe somebody using another e-mail when ask the deletion or mistype the phone number, so this two field not need to consist the two fields.

    Thank you!
    Peter

    • This topic was modified 1 year, 8 months ago by hollosipeter.
    • This topic was modified 1 year, 8 months ago by hollosipeter.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 34 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @hollosipeter

    Hope you are doing fine!

    Just need to make sure I understand the requirements for the form. Please find below the steps I understood have to be follow for each scenario.

    For users that are registering and not selecting the “Delete Previous Registration” checkbox

    1. Verify if email or phone number exists
    2. If email or phone number exists then stop the submission and then show the ““Sorry, but you didn’t have existing registration”?” message.
    3. If email and phone number doesn’t exist then proceed with the registration

    For users that are registering and selecting the “Delete Previous Registration” checkbox

    1. Verify if email or phone number exists
    2. If email or phone number exists then delete their current registration and add the new registration information.
    3. If email and phone number doesn’t exist then just add the new registration information.

    Could you confirm this is what you need? If I am missing anything please let me know in your reply.

    Kind regards

    Luis

    Thread Starter hollosipeter

    (@hollosipeter)

    Hello!
    Thank you for replying.
    I just want this IF user selects “deleting existing registration.
    If somebody normally register, I use you mu-plugin, and if a registration is already submitted, an error code given (phone or email). So I’m totally okay with this.
    So I just to prevent that somebody who never registered, checks the checkbox “delete previous registration” and submit a total false form. Because the deletion option is the first in my form (this is intentional so that anyone who registers knows for the future that there is an option to delete).

    But lot of people checking everything without reading and BEFORE a deleting request is coming I want to check that “is there any registration or not”. If not ,then show a message.

    I’m using different e-mail fields and phone number fields during registration and deletion (e-mail and phone 1-2), because I realized if somebody is registering, and with your existing mu-plugin I don’t allow to register again, it will be a problem with the deletion, because this is on the same form, that’s why I made rules, so when somebody checks “delete previous registration”, email2 and phone2 appearing.

    So the request is, when somebody checks “delete previous registration” and fills email2 or phone2, the system should check that there are active email1 or phone1 in the former submissions and if not, just write an error code “You don’t have any active registration” or something like that.

    Thank you!!

    • This reply was modified 1 year, 8 months ago by hollosipeter.
    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @hollosipeter

    I hope you’re well today!

    I think I understand what you want to achieve and I actually have a similar code already.

    It is, however, missing the “checkbox check” as it was built for a different purpose. So I gave it a spin and came up with slight modification that, I believe should work for you.

    Here you’ll find a modified version of that code which you should add to the site as MU plugin:

    https://pastebin.com/bS5sTbwE

    Once you add it, it will require a few configuration settings:

    1. First, you need to make sure that

    – you have a checkbox field on form for “delete previous registration”; it has to be a checkbox type field and must have only single option; it doesn’t matter what the option says and what’s its value – but it cannot be “multiple choice” checkbox

    – that checkbox MUST be physically located ABOVE the e-mail and phone fields that you want to check (this is important!)

    2. then in this code block you need to configure form ID(s) and field names as well as your custom message; I think it’s pretty self-explanatory

    $form_ids = array( 2245, 123 ); // form IDs - one or more; if more - separate numbers with commas
    $check_field_id = 'checkbox-1'; // ID of the field to determine if to do the data check or skip it; must be SINGLE checkbox
    $fields_ids = array( 'phone-1', 'email-1' ); // IDs of fields to check, one or more, if more - separate with commas
    $err_msg = 'Duplicated entry!'; // custom error message

    And that’s pretty much it. It should work out of the box and error message will be displayed directly below the checked field(s).

    Kind regards,
    Adam

    Thread Starter hollosipeter

    (@hollosipeter)

    Hello Adam! Thank you. I’m trying to test now but I see that “duplicate check with skip option”. This is good for my version? Because when somebody check “delete registration”, I want to check that existing registration is yes or no. And IF no, I want to show an error code with “Sorry, but you don’t have any active registration what you want to delete”.

    So I don’t want to say for the duplicates that “sorry, you already have a registration”, I already have this mu-plugin with the registration form.
    I want to say to the users when tries to delete but never registered: sorry, but you don’t have existing registration.

    It is the opposite yes? so check = true?

    And the other question:
    I need to check that given phone-2 or email-2 is existing between phone-1 or email-1 records – because deletion they are given phone-2 and email-2 what I should check that with this datas already exist in phone-1 and email-1 fields (because during the registration I’m using that).

    Thanks!
    Peter

    • This reply was modified 1 year, 8 months ago by hollosipeter.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @hollosipeter

    I hope you are doing well.

    This will require some changes in the Adam code.

    Wouldn’t you mind please share your form https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export using pastebin.com?

    Best Regards
    Patrick Freitas

    Thread Starter hollosipeter

    (@hollosipeter)

    Hello Patrick and Adam!

    This is the link for it:
    https://pastebin.com/qea6djQ2

    Thank you!
    Peter

    Thread Starter hollosipeter

    (@hollosipeter)

    I like to be add a code something like this:

    https://www.hollosipeter.hu/forminator-no-duplication-found.txt

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @hollosipeter

    Thanks for response!

    It seems I misunderstood your request initially. Assuming that code that you shared is working fine, you can try this version then (don’t mind the paste name, please):

    https://pastebin.com/rWzaNRGj

    You would again need to make sure that checkbox field for “delete” is above the other fields to check.

    Best regards,
    Adam

    Thread Starter hollosipeter

    (@hollosipeter)

    Hello Adam!

    The code what I wrote is my trials about Forminator’s documentstion, but I tried and not worked. If no submitted registration in phone-1 or email-1, I like to be get “error, no register.

    I try with “delete registration” checkbox, but seems like a form submitted and not say “sorry, you don’t have any registration”

    I tried with my own email and phone, not submitted before but the process not stopped. ??
    Thanks,
    Peter

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @hollosipeter,

    I’m afraid, we’ll have to bring this further to our developer’s attention in order to check what would be a possible workaround.

    However, just to be sure whether I understood your query, the current workflow you are looking to achieve is when the “Delete previous registration” checkbox is selected the email entered in the “email2” field should run a check with the existing submissions made on “email-1” field and then if there isn’t any entry it should display a message like “sorry, but you?don’t have?existing registration”, correct?

    Are you also looking to check phone numbers ie “phone-1” and “phone-2” along with that? Or is it only going to be a check with email-1 and email-2?

    Please do confirm the workflow, so that we could escalate this further to our developer’s attention.

    Looking forward to your response.

    Kind Regards,

    Nithin

    Thread Starter hollosipeter

    (@hollosipeter)

    Hello Nithin!
    Yes, exactly what you wrote!
    So technically I don’t need script for the checkbox because it is upon me – I mean, checkbox is not should be involve into this, because IF the checbox selected, based on the rule, just email-2 and phone-2 can be selected and we are assuming that I not modify the form to modify this part, so the focus is only on the email-2 and phone-2 field and the check for the existing data.

    And yes, phone is involving too, so for example if you are submitted before an [email protected] email-1 with a +18001234567 phone-1, and trying to delete with email-2 the same email, OR the same phone-2 record, should be checked – but separately, so email and phone fields are not need to see each other, just phone-2 checks existing phone-1 and email-2 checks existing phone-1.

    what I sent before a mu-plugin somehow not worked. Maybe if you can check it and correct what i mispelled, i will very grateful.

    Thank you,
    Peter

    Thread Starter hollosipeter

    (@hollosipeter)

    Somehow i couldn’t uncheck “resolved” but case is not resolved??

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @hollosipeter,

    Sorry for the delay regarding this. Thanks for explaining further, I’m escalating this further to our developer’s attention to check and provide a workaround based on the workflow you have confirmed.

    what I sent before a mu-plugin somehow not worked. Maybe if you can check it and correct what i mispelled, i will very grateful.

    I could also notice anomalies with the previous snippet, seems like it’ll require some rewrites.

    Please do note that developers work on complex queries and have a slow response time. We’ll keep you posted once I get further updates.

    Somehow i couldn’t uncheck “resolved” but case is not resolved??

    I have marked it as not resolved.

    Regards,

    Nithin

    Thread Starter hollosipeter

    (@hollosipeter)

    Thank you for your help, I’m waiting for the solution.

    Regards,
    Peter

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @hollosipeter,

    Could you please try this snippet and then check whether it helps?
    https://pastebin.com/Qkf6NWtU

    Please make sure to update the number 4866 in the above code to your form ID.

    The above snippet can be added as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Regards,

    Nithin

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘New form based on existing registration’ is closed to new replies.