Created
February 25, 2017 20:28
Revisions
-
joshfeck created this gist
Feb 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <?php //* Please do NOT include the opening php tag, except of course if you're starting with a blank file function ee_add_unique_email_validation(){ wp_add_inline_script( 'single_page_checkout', 'jQuery( document ).ready(function($) { $(".ee-reg-qstn-email").addClass("unique"); $.validator.addMethod("unique", function(value, element) { var parentForm = $(element).closest("form"); var timeRepeated = 0; if (value != "") { $(parentForm.find(":text")).each(function () { if ($(this).val() === value) { timeRepeated++; } }); } return timeRepeated === 1 || timeRepeated === 0; }, "* Duplicate! Please use a unique email address"); } );' ); } add_action( 'wp_enqueue_scripts', 'ee_add_unique_email_validation', 60 );