Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] Conditional Validation for Form Builder

Simple Membership Plugin › Forums › Simple Membership Plugin › Conditional Validation for Form Builder

  • This topic has 1 reply, 2 voices, and was last updated 9 months, 2 weeks ago by The Assurer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 19, 2025 at 11:46 am #31527
    dhruv_1256
    Participant

    Hello Support Team,

    I am using the Simple Membership plugin with the Form Builder addon.

    I need to set up conditional validation for one of my custom fields (Teen Email – field name/ID: swpm-30).

    Specifically:

    If the URL contains a parameter teen_email, then this field should not be required (validation skipped).

    If the URL does not contain teen_email, then the field should remain required.

    I have tried the following code (based on the swpm_fb_front_end_registration_form_submitted hook), but it did not work:

    add_action('swpm_fb_front_end_registration_form_submitted', function(&$sanitized) {
        // If teen_email is present in the URL
        if (isset($_GET['teen_email']) && !empty($_GET['teen_email'])) {
            if (isset($sanitized['swpm-30'])) {
                $sanitized['swpm-30'] = '';
            }
        }
    }, 10, 1);

    it does not actually bypass the required validation.

    Can you please confirm:

    1) Which is the correct action/filter hook to use for custom conditional validation in the Form Builder?

    2) How can I override the “required” validation for this field only when teen_email exists in the URL?

    This is an important requirement for our workflow, and any code snippet or guidance would be very helpful.

    Thank you,
    Dhruv

    September 19, 2025 at 10:04 pm #31528
    The Assurer
    Moderator

    For support with Premium Addons, please complete a Premium Addon Support ticket.
    https://simple-membership-plugin.com/premium-addon-support/

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy