Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Created December 30, 2013 03:35
Show Gist options
  • Select an option

  • Save BFTrick/8177493 to your computer and use it in GitHub Desktop.

Select an option

Save BFTrick/8177493 to your computer and use it in GitHub Desktop.
Hide all unchecked frields in emails.
<?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' );
@JupiterVisual

Copy link
Copy Markdown

Are there installation instructions for this file? Thank you.

@carbfrze

Copy link
Copy Markdown

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