Server IP : 172.67.157.199 / Your IP : 18.188.164.209 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/profile-builder/features/content-restriction/assets/js/ |
Upload File : |
jQuery( function(){ /* Display custom redirect URL section if type of restriction is "Redirect" */ jQuery( 'input[type=radio][name=wppb-content-restrict-type]' ).on( "click", function() { if( jQuery( this ).is(':checked') && jQuery( this ).val() == 'redirect' ){ jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).addClass( 'wppb-content-restriction-enabled' ); // hide the custom restriction messages section (not needed for Redirect) jQuery( '#wppb-meta-box-fields-wrapper-restriction-custom-messages' ).hide(); } else { jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); // this needs to be unchecked so that the Custom URL is properly disabled jQuery( '#wppb-content-restrict-custom-redirect-url-enabled' ).prop( 'checked', false ); jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); // show the custom restriction messages section jQuery( '#wppb-meta-box-fields-wrapper-restriction-custom-messages' ).show(); } } ); /* Display custom redirect URL field */ jQuery( '#wppb-content-restrict-custom-redirect-url-enabled' ).on( "click", function() { if( jQuery( this ).is( ':checked' ) ) jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).addClass( 'wppb-content-restriction-enabled' ); else jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); } ); /* Display custom messages editors */ jQuery( '#wppb-content-restrict-messages-enabled' ).on( "click", function() { if( jQuery( this ).is( ':checked' ) ) jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).addClass( 'wppb-content-restriction-enabled' ); else jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).removeClass( 'wppb-content-restriction-enabled' ); } ); /* Disable / Enable the user roles from the "Display for" field if the "Logged in Users" option is checked or not */ jQuery( document ).on( 'click', 'input[name="wppb-content-restrict-user-status"]', function() { wppb_disable_enable_user_roles( jQuery( this ) ); } ); jQuery( 'input[name="wppb-content-restrict-user-status"]' ).each( function() { wppb_disable_enable_user_roles( jQuery( this ) ); } ); function wppb_disable_enable_user_roles( $element ) { $wrapper = $element.closest( '.wppb-meta-box-field-wrapper' ); if( $element.is( ':checked' ) ) { $wrapper.find( 'input[name="wppb-content-restrict-user-role[]"]' ).attr( 'disabled', false ); } else { $wrapper.find( 'input[name="wppb-content-restrict-user-role[]"]' ).attr( 'disabled', true ); } } } );