PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.8
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.8
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / features / content-restriction / assets / js / content-restriction.js

content-restriction.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.8, at features/content-restriction/assets/js/content-restriction.js

48 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( function(){
2
3 /* Display custom redirect URL section if type of restriction is "Redirect" */
4 jQuery( 'input[type=radio][name=wppb-content-restrict-type]' ).on( "click", function() {
5 if( jQuery( this ).is(':checked') && jQuery( this ).val() == 'redirect' )
6 jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).addClass( 'wppb-content-restriction-enabled' );
7 else
8 jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' );
9 } );
10
11 /* Display custom redirect URL field */
12 jQuery( '#wppb-content-restrict-custom-redirect-url-enabled' ).on( "click", function() {
13 if( jQuery( this ).is( ':checked' ) )
14 jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).addClass( 'wppb-content-restriction-enabled' );
15 else
16 jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' );
17 } );
18
19 /* Display custom messages editors */
20 jQuery( '#wppb-content-restrict-messages-enabled' ).on( "click", function() {
21 if( jQuery( this ).is( ':checked' ) )
22 jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).addClass( 'wppb-content-restriction-enabled' );
23 else
24 jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).removeClass( 'wppb-content-restriction-enabled' );
25 } );
26
27
28 /* Disable / Enable the user roles from the "Display for" field if the "Logged in Users" option is checked or not */
29 jQuery( document ).on( 'click', 'input[name="wppb-content-restrict-user-status"]', function() {
30 wppb_disable_enable_user_roles( jQuery( this ) );
31 } );
32
33 jQuery( 'input[name="wppb-content-restrict-user-status"]' ).each( function() {
34 wppb_disable_enable_user_roles( jQuery( this ) );
35 } );
36
37
38 function wppb_disable_enable_user_roles( $element ) {
39 $wrapper = $element.closest( '.wppb-meta-box-field-wrapper' );
40
41 if( $element.is( ':checked' ) ) {
42 $wrapper.find( 'input[name="wppb-content-restrict-user-role[]"]' ).attr( 'disabled', false );
43 } else {
44 $wrapper.find( 'input[name="wppb-content-restrict-user-role[]"]' ).attr( 'disabled', true );
45 }
46 }
47
48 } );