Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created July 22, 2016 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/38ef04e39c92f7e550005c9784700da0 to your computer and use it in GitHub Desktop.
Save joshfeck/38ef04e39c92f7e550005c9784700da0 to your computer and use it in GitHub Desktop.
Make auto-input fields read only. For use with Event Espresso 4 + the WP Users integration add-on
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_readonly_autofilled_inputs(){
wp_add_inline_script(
'jquery-validate',
'jQuery(document).ready(function($){
$.extend($.expr[":"],{
textboxFilled: function(el){
return $(el).val() !== "";
}
});
$("#spco-attendee_information-dv .ee-reg-form-attendee-dv:first :text:textboxFilled").prop("readonly", true);
});'
);
}
add_action( 'wp_enqueue_scripts', 'ee_readonly_autofilled_inputs', 50 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment