Code Examples

# Add print button to Single Page using Custom HTML field

<input type="button" value="Print" onClick="window.print()">

#Send user email after entry is approved

add_action( 'nf_views/approve_submission/approved', 'wh_email_user_on_approval' );
function wh_email_user_on_approval( $sub_id ) {
	$sub = Ninja_Forms()->form()->get_sub( $sub_id );

	$user_email_field_key = 'email_1566280604823';// Update this to the field key of the email field which saves user email id.

	$user_email = $sub->get_field_value( $user_email_field_key );

	if ( ! empty( $user_email ) ) {
		$subject = 'The subject'; 
		$body = 'The email body content';
		$headers = array( 'Content-Type: text/html; charset=UTF-8' );
		wp_mail( $user_email, $subject, $body, $headers );
	}

}