Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Make sure user has enough funds. When user don’t have enough funds, it shows you the system error, but order status changes to pending. Maybe a bug and if somebody can solve it for us.

    I also verify that this is not working in 4.2. Just a blank screen when trying to add.

    Thread Starter zeevee1

    (@zeevee1)

    I have created this plugin and wanted to see if developer can point out if this is correct or need some work, please:

    <?php
    function wpcf7_check_dob (&$WPCF7_ContactForm) {
    $dob = $WPCF7_ContactForm->posted_data[‘DOB’];
    $d2 = new Date();
    $diff = 0;

    if ($dob && $d2) {
    $diff = Math.floor(($d2.getTime() – $dob.getTime()) / 86400000); // ms per day
    }

    $diff = Math.floor($diff / 365);
    console.log($diff);
    if ($diff < 18) {
    $result[‘valid’] = false;
    $result[‘reason’][$name] = wpcf7_get_message(‘invalid_required’);
    } else {
    //DO NOTHING, MOVE FORWARD.
    }
    }
    add_action(“wpcf7_before_send_mail”, “wpcf7_check_dob”);
    ?>

    Thread Starter zeevee1

    (@zeevee1)

    Anybody, somebody 😉

    Pjamedia, not sure if the following will work for you, but if you put this in your backend, date picker will only show you the dates under 21:

    [date* DOB id:DOB class:DOB readonly date-format:mm/dd/yy year-range:1910 max-date:-7670D change-month change-year buttons]

    max-date:-7670D is 21, change it to 6574 for 18 and it will only let user select the dates of 18 and over.

    What I am trying to achieve is give user the whole calendar and then do the calculation of 21years and present them with error.

    Any help is appreciated.

    Same here, I would like to know how to throw an error if date selected is under 21. Anybody, somebody, pleeeease 😉

    Thread Starter zeevee1

    (@zeevee1)

    Well I think the support is dead for this plugin, but I have an answer if somebody else is trying to implement this:

    functions.php, Line 325

    case ‘dropdowns’ :
    $form.='<p><select name=”av_verify_m” id=”av_verify_m”>’;
    $form.='<option value=”” disabled selected>Month</option>’;
    foreach ( range( 1, 12 ) as $month ) :
    $month_name = date( ‘F’, mktime( 0, 0, 0, $month, 1 ) );
    $form .= ‘<option value=”‘ . $month . ‘”>’ . $month_name . ‘</option>’;

    endforeach;

    $form .= ‘</select> – <select name=”av_verify_d” id=”av_verify_d”>’;
    $form.='<option value=”” disabled selected>Date</option>’;
    foreach ( range( 1, 31 ) as $day ) :
    $form .= ‘<option value=”‘ . $day . ‘”>’ . esc_html( zeroise( $day, 2 ) ) . ‘</option>’;

    endforeach;

    $form .= ‘</select> – <select name=”av_verify_y” id=”av_verify_y”>’;
    $form.='<option value=”” disabled selected>Year</option>’;
    foreach ( range( 1910, date( ‘Y’ ) ) as $year ) :
    $selected = ( $year == date( ‘Y’ ) ) ? ‘selected=”selected”‘ : ”;
    $form .= ‘<option value=”‘ . $year . ‘”>’ . $year . ‘</option>’;

    endforeach;

    $form .= ‘</select></p>’;

    break;

    Not an expert by any means but I think you have rearrange the fields in a functions.php

    Code:
    $form .= '<p><input type="text" name="av_verify_m" id="av_verify_m" maxlength="2" value="" placeholder="MM" /> - <input type="text" name="av_verify_d" id="av_verify_d" maxlength="2" value="" placeholder="DD" /> - <input type="text" name="av_verify_y" id="av_verify_y" maxlength="4" value="" placeholder="YYYY" /></p>';

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

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