Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created November 25, 2016 17:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/abebd6fb3cdc796bf1f913de6c6d1816 to your computer and use it in GitHub Desktop.
Save joshfeck/abebd6fb3cdc796bf1f913de6c6d1816 to your computer and use it in GitHub Desktop.
You can put this code snippet on your site and it will disable the EE4 registration form field inputs for First Name, Last Name, and Email if the user is logged into the website. Useful with the WP User add-on.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_custom_disable_specific_questions() {
if ( is_user_logged_in() ) {
wp_add_inline_script(
'ee_form_section_validation',
'jQuery( document ).ready(function($) {
$("input[id$=-fname],input[id$=-lname],input[id$=-email]").prop( "readonly", true );
});'
);
}
}
add_action( 'wp_enqueue_scripts', 'ee_custom_disable_specific_questions', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment