Created
December 30, 2013 03:35
-
-
Save BFTrick/8177493 to your computer and use it in GitHub Desktop.
Hide all unchecked frields in emails.
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 characters
| <?php | |
| function my_ninja_forms_hide_unchecked( ) { | |
| global $ninja_forms_processing; | |
| // get all the user submitted values | |
| $all_fields = $ninja_forms_processing->get_all_fields(); | |
| if ( is_array( $all_fields ) ) { | |
| // loop through each of our submitted values. | |
| foreach ( $all_fields as $key => $value ) { | |
| // if a value is set to unchecked then remove it | |
| if ( 'unchecked' == $value ) { | |
| $ninja_forms_processing->remove_field_value( $key ); | |
| } | |
| } | |
| } | |
| } | |
| add_action( 'ninja_forms_process', 'my_ninja_forms_hide_unchecked' ); |
Just insert this block of code minus the opening <?php into your themes function.php file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are there installation instructions for this file? Thank you.